Reputation:
$ npm install
module.js:471
throw err;
^
Error: Cannot find module 'C:\c\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
module.js:471
throw err;
^
Error: Cannot find module 'C:\c\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
I have noticed this
C:\c\Program Files\
I think that the path is being overrided, I have set the paths in my environment variables
NodeJs works good when I donode -V
I get the version and when I do npm -V
it crashes how can I solve this
PS: I am using Windows 10 Pro
Upvotes: 2
Views: 5392
Reputation: 49
If you have reinstall the Node.Js and previously you have set the node path in environment variable then you should remove it then it will work
Upvotes: 0
Reputation: 3224
In Program Files\nodejs\npm
, node.exe
is executed and not a node script, because of this, git-bash
converts npm-cli.js
's path to a Windows path.
npm Version: 3.10.10 Platform: MINGW64_NT-6.1 2.5.0(0.295/5/3) 2016-03-31 18:47 x86_64 Msys
When I run npm (/c/Program Files/nodejs/npm) in a git bash (which uses MINGW) the npm script throws: Error: Cannot find module 'C:\c\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
The problem is that the npm shell script executes a window node.exe but supplies it with a unix path for the npm-cli.js.
As I see it the fix is to also convert the path with cygpath for MINGW as well in /c/Program Files/nodejs/npm line 6-8:
case `uname` in *CYGWIN*) basedir=`cygpath -w "$basedir"`;; *MINGW*) basedir=`cygpath -w "$basedir"`;; esac
Read NPM issue #18499 on GitHub for more information.
Upvotes: 4
Reputation: 21
you should install the only LTS version of node https://nodejs.org/en/
Upvotes: 0
Reputation:
I have found a solution, it's due to this variable located in environment variables:
MSYS_NO_PATHCONV=1
I don't know why this conflict is happening, in any case If i find it I will update my answer
Upvotes: 2