When trying to run cordova cli on OSX get an error
env: node\r: No such file or directory
I got the latest version of cordova from npm so I think it is 3.0.7
Solution:
$ brew install dos2unix
$ find /usr/local/lib/node_modules -name "*.js" | xargs sudo dos2unix
Details:
The problem for OP was to do with Git, However I am taking a moment to mention the quick fix for most of it's cases
The problem will show up if Node tries to execute .js
file which has windows style line endings. Problem might come from third party npm packages which has .js
files of that kind.
As @Leo mentioned Dos2Unix is the answer, Here is the chain of commands for an example situation while I was trying to install Slack-cli
> npm install -g slack-cli
> slackcli
env: node\r: No such file or directory
The fix looks like
> brew install dos2unix
> find /usr/local/lib/node_modules/slack-cli -name "*.js" | xargs sudo dos2unix
> slackcli --help
Walla..