Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' #572
-
It's uncertain why I am getting this error after running internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:747:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:747:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
} |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 40 replies
-
run this in the command line. SET PATH=C:\Program Files\Nodejs;%PATH% |
Beta Was this translation helpful? Give feedback.
-
For those arriving via Google, search the issues for this problem and review the wiki for answers. There are many reasons why this can happen. The issues have unique responses for different circumstances. Also see: Common Issues |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
+1 same problem. I found that after "nvm install ..." the npm is downloaded as .zip under %NVM_ROOT%/temp but instead of, after download npm package, to copy the npm package to %NODE_ROOT%/node_modules the file .zip is excluded. In order to work, we need to copy the downloaded package to node_modules manually, however we need to do it before the downloaded npm package is deleted. |
Beta Was this translation helpful? Give feedback.
-
I am getting same issue. Please any one help me |
Beta Was this translation helpful? Give feedback.
-
Many of those experiencing this issue likely have a space in your username. Make sure you upgrade to NVM 1.1.8, which resolves the space and special character issues. See the Common Issues for more help. |
Beta Was this translation helpful? Give feedback.
-
可以删除window的环境变量后重启电脑,并重新建立NODE_HOME |
Beta Was this translation helpful? Give feedback.
-
check your all files in folder, may be extra file named SERVER has been created.. Delete it... I faced the same issue... May be this will help.. |
Beta Was this translation helpful? Give feedback.
-
I was facing the same issue, and the best way to solve this issue is to delete nodejs and reinstall it. Make sure to change the path from program files to somewhere else. |
Beta Was this translation helpful? Give feedback.
-
I solved this problem by removing the old path from node and npm and adding them again. |
Beta Was this translation helpful? Give feedback.
-
For Windows machines
This worked on my laptop. |
Beta Was this translation helpful? Give feedback.
-
i do not know what happened. can not run NMP and dispay:Error: Cannot find module 'C:\TEMP\NodeJS\node_modules\npm\bin\npm-cli.js' |
Beta Was this translation helpful? Give feedback.
-
I don't know if this is helpful to anyone, but I tried all of these steps and other things as well and no resolution. Then I tried to install the same version that was installed on my WSL instance (19.6.1), and for whatever reason it installed perfectly with no issues and now works properly. There may be something that I did that fixed the underlying issue that I'm not aware of, or maybe this issue only pops up with certain versions of node, or ... 🤷 |
Beta Was this translation helpful? Give feedback.
-
Multiple years later, this issue is still opend. I followed many steps to debug this... that installing on somewhere without specials char or space 😭 The only fix for me ... dont trust spaces and install somewhere else this crap |
Beta Was this translation helpful? Give feedback.
Many of those experiencing this issue likely have a space in your username. Make sure you upgrade to NVM 1.1.8, which resolves the space and special character issues.
See the Common Issues for more help.