Hey all - I am seeing the same problem, and the problem seem to be using "nvm" to install a new version. I tried this with several different versions, including the current release, but the result is always the same.
The version is listed as installed, and "nvm use" with the new version just installed works fine. However something must be going wrong during the installation, because when I look in the newly created root folder for that version, the "node_modules" folder that should contain a "npm" folder is empty, which tells me that the installation is incomplete
The only version that currently works is the first on I installed, but all version are consistently incorrectly installed. The version folder itself is created and I can use the version, but seeing as the folder is empty it makes perfect sense this error is thrown, since the npm-cli.js file is literally not there.
So files are missing after install, but the reason why has so far eluded me.
Best regards,
Michael
PS C:\Users\MyUser> nvm install 12.18.2
Downloading node.js version 12.18.2 (64-bit)...
Complete
Creating C:\Users\MyUser\AppData\Roaming\nvm\temp
Downloading npm version 6.14.5... Complete
Installing npm v6.14.5...
Installation complete. If you want to use this version, type
nvm use 12.18.2
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module 'C:\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module 'C:\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
@Poltergeisen - this usually happens when a prior version of Node existed before NVM4W was installed. It can also happen if NVM4W can't move the installations to the new directory.
@rmsilva1973 That looks like an error message from an older version of NVM4W.
@Miclarsen1 If you had Node installed prior to NVM4W, npm can get confused about where it is being copied to.
@jayasingh1, @javierpr71 Same thing, pre-existing versions of Node often cause this.
If Node exists before NVM4W is installed, the system PATH often still points to old versions of Node. npm uses these same paths.
So, i'm running into a pretty well know problem. In which the fixes are not working for me. It's the one where nvm throws the error: The system cannot find the path specified.
Originally this error was thrown when there were spaces in the path for both the NVM_HOME and NVM_SYSLINK paths. However, both paths are configured to be simple folders in the root of my E: drive. (E:\nvm, E:\nodejs). So that shouldn't be causing the issue.
I did install the shadow patch recommended on the wiki to see if that would fix my issue. But to no avail.
This issue seemed to surface when I upgraded my windows machine to version 1809. I don't know if that correlates. But it seems worth mentioning.
I've been manually changing versions since (my computer was upgraded in May), but I'm now working on multiple projects that's kinda making it impractical to do. Anything I can do to help troubleshoot this further? I'd really like to get it working.
@coreybutler I stumbled upon the fix out of the blue. I noticed something about my command prompt that looked off when I launched it today that may have been there for months without me noticing.
This stack exchange post explains it: https://superuser.com/questions/727316/error-in-command-line-the-system-cannot-find-the-path-specified
Essentially it was an incorrect configuration for Command Prompt that caused this issue. Clearing out this value and relaunching CMD fixed my issue. Thank you for your time.
Yeah, it is very obscure. When I saw the "The system cannot find the path specified." message at the top of the prompt, I kinda questioned my sanity at that point. I use powershell mostly (because of vscode) so that may explain why I never noticed it. When I cleared that value in the registry I noticed it was a single path value, to miniconda. Which I uninstalled when I realized I needed the full suit of annaconda.
So this is a problem that can occur when console specific applications are uninstalled, and the program does not perform a clean uninstall. Which is definitely handy to know for troubleshooting in the future.
Hi guys, can someone explain me how global packages works in nvm? For example, I'm in node version X and have a global package with a version A, when I change to node version Y, the global package is still there with version A. Why is that? Shouldn't the global package only exists in the node version I installed it? Or have different global package version for each nove version?
Thanks for everything, nvm is awesome
I totally removed NVM and Node, then got the latest NVM version and successfully installed the latest version of Node (14.8.0) plus npm. However, these versions that NVM downloaded seem non-functional.
When I try to use node, I get this error:
Program 'node.exe' failed to run: The specified executable is not a valid application for this OS platform
When I try to run npm, I get Access is denied.
and a popup saying the app cannot run on my computer.