Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 'bin' is not recognized as an internal or external command, operable program or batch file #127

Closed
jhuynh85 opened this issue Aug 20, 2020 · 4 comments · Fixed by #160

Comments

@jhuynh85
Copy link
Contributor

STEPS TO REPRODUCE

  1. On a Windows machine, run npm start

RESULT
npm start will fail with the error 'bin' is not recognized as an internal or external command, operable program or batch file.

ADDITIONAL INFO
This error is due to npm start also running the get-contributors script which is the command bin/generate-contributors-json.js. This is not recognized as a valid command in Windows.

SOLUTION 1
Change the get-contributors script from bin/generate-contributors-json.js to node bin/generate-contributors-json.js

SOLUTION 2
Install the cross-env package which will allow the same npm scripts to be run on all platforms. This also has the benefit of avoiding potential issues with setting environment variables directly in npm scripts (which requires different syntax in Windows).

@jhuynh85
Copy link
Contributor Author

jhuynh85 commented Aug 20, 2020

Let me know if you guys want to fix this (as this is a Windows-only issue) and which solution you prefer

@pickleat
Copy link
Collaborator

Hey @jhuynh85 thanks for this! I wanted to let you know I've seen it, but I'm still thinking about the best solution. Part of me thinks we can ignore it, as it's a build task that should run before a deploy. Therefore not really necessary for local development, save for when people are working on this feature. If its just a matter of a separate build script for windows, maybe we can add another one and not add another dependency? Not sure yet, but that's my thinking so far. I'll get back to you, but feel free to give me your opinion as nothing is decided yet and I'm open to being convinced.

@nickytonline
Copy link
Contributor

nickytonline commented Aug 21, 2020

I wasn't sure which environments were supported for development as it's not indicated in the project. I assumed Linux environment based on the postcss script, https://github.com/drewclem/protege/blob/master/package.json#L30, but maybe postcss internally handles /s in directories for Windows.

For Windows this would work on WSL, but if you're not on WSL, it would 100% error out like you mention in the issue. I don't think it's a big deal to have WSL as a requirement, but that is probably another discussion.

  • It could be just for the build and when doing local dev, copy a dummy json file so that things work on local dev. The reason I did not do this was to ensure the flow was the same whether building for dev or prod. Having said that, if the script fails during a deploy, the deploy will fail.

  • I had considered just running it as node bin/generate-contributors-json.js. There's nothing wrong with this.

For cross-env, from the times I've used it, seems to be only for setting environment variables. I don't think it can run a linux command as it defaults to cmd on Windows when running npm commands and even if it could, it would probably require WSL or CygWin for that.

Also, it's been quite a long time that I've used Windows for development, so I do not know how node handles filepaths if they are forward slashes in scripts on a Windows machine.

@nickytonline
Copy link
Contributor

This is no longer an issue at all since #228.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants