jscodeshift: Version: 0.12.0. /usr/bin/env: ‘node\r’: No such file or directory
Execute jscodeshift with an error
/usr/bin/env: ‘node\r’: No such file or directory
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 46
- Comments: 15 (5 by maintainers)
Commits related to this issue
- feat(crlf): add ending space to avoid env: node\r: No such file or directory, fix #424 — committed to sibelius/jscodeshift by sibelius a year ago
- feat(crlf): add ending space to avoid env: node\r: No such file or directory, fix #424 — committed to facebook/jscodeshift by sibelius a year ago
Ran into this because I tried to install with yarn via
yarn global add jscodeshift, but yarn doesn’t convert windows line endingsYou have to install with npm per the readme (npm converts the line endings):
Another workaround is to call the
jscodeshiftbin innode_modulesdirectly, which bypass the shebang at the top of the script -This is useful if jscodeshift is being called as part of a script, and the package is installed separately or if it’s not possible to use a different package manager
Still an issue in the latest version. Only way to combat this was to downgrade to 0.11.0 which does not have the same issue.
This is still an issue in 0.13.0.
any workaround on m1?
You can also reference the
./node_modules/.bin/jscodeshiftdirectly in an npm script. eg:package.js