Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM not recognized in Powershell or Command Prompt #612

Closed
bleepzter opened this issue Feb 7, 2021 · 6 comments
Closed

NPM not recognized in Powershell or Command Prompt #612

bleepzter opened this issue Feb 7, 2021 · 6 comments

Comments

@bleepzter
Copy link

My Environment

  • Windows 10 Pro

I noticed that NVM installed in:
C:\Users[user]\AppData\Roaming\nvm\

It created a symbolic link in "C:\Program Files\nodejs" pointing to:
C:\Users[user]\AppData\Roaming\nvm\v15.8.0

It also created the following system environment variables:
NVM_HOME: C:\Users[user]\AppData\Roaming\nvm
NVM_SYMLINK: C:\Program Files\nodejs\

and the following user environment variables:
NVM_HOME: C:\Users[user]\AppData\Roaming\nvm
NVM_SYMLINK: C:\Program Files\nodejs\

The path system and user environment variable includes both:
%NVM_HOME%
%NVM_SYMLINK%

Expected Behavior

npm install -g angular@latest should work.

Actual Behavior

node --version works and returns the correct version number. However NPM does not.

image

image

Steps to reproduce the problem:

Download the installer for windows. (1.1.7)
Run the installer.
Install Node v15.8.0

image

@TiKevin83
Copy link

probably related to #606

@shorstki
Copy link

It's probably more like each node version installed with nvm have separate npm and changing version in NVM is not changing path to right npm. And also each node has separate node-modules, so packages installed with different node and npm are in different locations NVM_HOME/node version/node-modules

@coreybutler
Copy link
Owner

@shorstki is correct. There is a different installation directory for each version of node and its modules. Global npm modules must be reinstalled for each version, since each version is treated separately.

There are other reasons npm may not be recognized. Spaces in path names/install roots were a challenge in v1.1.7, but have been resolved in https://github.com/coreybutler/nvm-windows/releases/tag/1.1.8. Lacking permissions can also cause this when using a protected directory (like C:\Program Files).

I'm closing this because I believe the technical issues have been resolved in v1.1.8. It is important to understand that each version of Node is treated as an independent installation though. Managing the npm environment is not in the scope of this project, but it is being considered in rt (the successor project I'm working on - see the "welcome" thread in the Github discussions for details).

@aahmedfaraz
Copy link

This is because it is powershell, try command prompt (administrator)

@coreybutler
Copy link
Owner

@aahmedfaraz no - this is not due to the shell. NVM4W is supported in both PowerShell and the standard command prompt.

@boualikamel
Copy link

@shorstki is correct. There is a different installation directory for each version of node and its modules. Global npm modules must be reinstalled for each version, since each version is treated separately.

There are other reasons npm may not be recognized. Spaces in path names/install roots were a challenge in v1.1.7, but have been resolved in https://github.com/coreybutler/nvm-windows/releases/tag/1.1.8. Lacking permissions can also cause this when using a protected directory (like C:\Program Files).

I'm closing this because I believe the technical issues have been resolved in v1.1.8. It is important to understand that each version of Node is treated as an independent installation though. Managing the npm environment is not in the scope of this project, but it is being considered in rt (the successor project I'm working on - see the "welcome" thread in the Github discussions for details).

unfortunately it's not working in new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants