git bash cannot find module npm-cli.js

$ 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

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.

Windows: Unable to find npm-cli.js running npm in bash · Issue , 1 with the same result. Running any npm command results in a cannot find module error: $ npm update internal/modules/cjs/loader.js:  This is running in the bash for windows terminal installed by git for windows. I thought it might be due to a Git update and rolled back to 2.24.1 with the same result. Running any npm command results in a cannot find module error:

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

Error: Cannot find module 'C:\Program Files\nodejs , Error: Cannot find module 'C:\node_modules\npm\bin\npm-cli.js' In the case you are in Windows Subsystem for Linux, just have to close an  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 odejs ode_modules pm\bin pm-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.

you should install the only LTS version of node https://nodejs.org/en/

git bash cannot find module npm-cli.js, 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. npx issue on Windows: cannot find module \Program Files odejs ode_modules pm\bin pm-cli.js I use a proxy when downloading Git repos. I access the npm

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

Git bash though error while run npm packages - node.js - html, After cloning a repo you should run : npm install in your git root folder to install npm dependencies before being able to git bash cannot find module npm-cli.js. I'm opening this issue because: [ x] npm is crashing. npm is producing an incorrect install. npm is doing something I don't understand. Other (see below for feature requests): What's going wrong? $ npm update npm ERR!

npm-cli.js not found when running npm - node.js - html, I also try to find npm-cli.js and see it's actually in C:\Program Error: Cannot find module 'SOME_PATH\node_modules\npm\bin\npm-cli.js' Here is what I write (​in a git bash shell on windows ): PATH="/c/Program Files/nodejs/:$PATH" npm  I'm opening this issue because: npx is crashing. npm is producing an incorrect install. npm is doing something I don't understand. Other (see below for feature requests): What's going w

coreybutler/nvm-windows, When I install Node 10.x via NVM-Windows it installs NPM v5.6.0. node -v v8.9.​4 PS C:\nvm> npm -v module.js:540 throw err; ^ Error: Cannot find module @​coreybutler Second screenshot was from Git Bash, but I had the same result when  @kennethlimcp good news. I installed uninstalled Node 10.38 and deleted all the folders it had created in Program Files and in AppData. Then I installed the latest Node (12.3) with the installer located in c:\user\sergio (the previous time the installer was in c:).

Windows 7 NPM installation problems with properly (I think) set , Node is running properly from git, but when I try to install bower. module.js:340 throw err; ^ Error: Cannot find module system for a lot of things, but as a professional developer I very much prefer Linux when it comes to development needs. Questions: I have git bash open and I type in npm install and then it returns: bash: npm command not found I don’t understand, because I have node.js command prompt and when I type in npm -v then it returns 3.7.3.

Comments
  • What's your PATH set to? (echo $PATH)
  • Not sure what this has to do with either git or bash, can you check if npm crashes with the same error if you run it from the command prompt that comes with Windows?
  • Yes I have tested it in power shell and it works just fine, but I need to fix and git bash too for some reasons