Nvm-windows: The global npm directory is not put in the environment variable

Created on 11 Sep 2018  路  7Comments  路  Source: coreybutler/nvm-windows

If this is a question about how to use NVM4W, please use stackoverflow instead.

If this is an issue regarding antivirus, make sure you search the existing issues first.

My Environment

  • [ ] Windows 7 or below (not truly supported due to EOL - see wiki for details)
  • [ ] Windows 8
  • [ ] Windows 8.1
  • [x] Windows 10
  • [ ] Windows 10 IoT Core
  • [ ] Windows Server 2012
  • [ ] Windows Server 2012 R2
  • [ ] Windows Server 2016

  • [ ] My Windows installation is non-English.

I'm using NVM4W version:

  • [ x] 1.1.7
  • [ ] 1.1.6
  • [ ] 1.1.5
  • [ ] 1.1.4
  • [ ] 1.1.3
  • [ ] 1.1.2
  • [ ] 1.1.1
  • [ ] Older
  • [ ] OTHER (Please Specify)

I have already...

  • [x ] read the README to be aware of npm gotchas & antivirus issues.
  • [x ] reviewed the wiki to make sure my issue hasn't already been resolved.
  • [x ] verified I'm using an account with administrative privileges.
  • [x ] searched the issues (open and closed) to make sure this isn't a duplicate.
  • [x ] made sure this isn't a question about how to use NVM for Windows, since gitter is used for questions and comments.

My issue is related to (check only those which apply):

  • [ ] settings.txt
  • [ ] proxy support (Have you tried version 1.1.0+?)
  • [ ] 32 or 64 bit support (Have you tried version 1.1.3+?)
  • [ ] Character escaping (Have you tried version 1.1.6+?)
  • [ ] A standard shell environment (terminal/powershell)
  • [ ] A non-standard shell environment (Cmder, Hyper, Cygwin, git)

Expected Behavior

After I install nvm-windows, the C:UsersadminAppDataRoamingnpm that contains all my global commands should be added into PATH variable but this is not.

Actual Behavior

This is not - I have to manually go and add this directory to PATH variable

Steps to reproduce the problem:

Install nvm-windows
run npm install -g @angular/cli
close powershell window and re-open
run "ng new newProject"
It's going to say it "ng is not recognised command"
Go into environment variables, and add "C:UsersadminAppDataRoamingnpm" to PATH
Open another powershell window, and run "ng new newProject", it'll now work

Most helpful comment

I thought I would repeat the above on the laptop supplied by my client

1) installed the last verison of NVM4W installer (1.17.4)

2) set the proxy url

nvm proxy myclientproxy.com:xxxx

位 nvm install 8.12.0
Downloading node.js version 8.12.0 (64-bit)...
Complete
Downloading npm version 6.4.1... Download failed. Rolling Back.
Rollback failed. remove C:\Users\Daniel\AppData\Roaming\nvm\temp\npm-v6.4.1.zip: The process cannot access the file because it is being used by another process.
Could not download npm for node v8.12.0.
Please visit https://github.com/npm/cli/releases/tag/v6.4.1 to download npm.
It should be extracted to C:\Users\Daniel\AppData\Roaming\nvm\v8.12.0

Any advice on how resolve this or perform a manual install.

All 7 comments

Actually maybe this is me misunderstanding how nvm-windows is supposed to work.

Can someone clarify, is nvm-windows supposed to put my global npm packages (eg. yarn, ng) into c:usersadminappdataroamingnvm?

It looks to me on my computer, the global packages are put in c:usersadminappdataroamingnpm - only the node versions are put into c:usersadminappdataroamingnvm.

This is why the global commands do not work until I add c:usersadminappdataroamingnpm into SYSTEM PATH.

Can someone clarify, is nvm-windows supposed to put my global npm packages (eg. yarn, ng) into c:usersadminappdataroamingnvm?

No it is not. That is the right behavior you are experiencing. Also nvm adds the c:\users\admin\appdata\roaming\npm to the PATH if it didn't you couldn't access npm.

Can someone clarify, is nvm-windows supposed to put my global npm packages (eg. yarn, ng) into c:usersadminappdataroamingnvm?

No it is not. That is the right behavior you are experiencing. Also nvm adds the c:\users\admin\appdata\roaming\npm to the PATH if it didn't you couldn't access npm.

Ok well it didn't add the c:\users\admin\appdata\roaming\npm directory to PATH for me. I had to manually add this afterwards.

It added NVM_HOME which linked to c:usersadminappdataroamingnvm and
NVM_SYMLINK which linked to c:program filesnodejs

i could access npm because c:program filesnodejs was pointing to my current version of node (eg. C:UsersadminAppDataRoamingnvmv10.10.0)

I was getting this issue but realised this hadn't run this sucessfully
nvm install 8.12.0

Downloading node.js version 8.12.0 (64-bit)...
Complete
Downloading npm version 6.4.1... Download -failed. Rolling Back.

I think this explains the path not set. Anyway installed nvm 1.17 and successfully run the above - it adds these env vars which get appended to the path env var

NVM_HOME=C:\Users\danie\AppData\Roaming\nvm
NVM_SYMLINK=C:\Program Files\nodejs

npm is seen by the path and I stop getting the error mentioned in this thread
位 npm version
{ npm: '6.4.1',
.....

I thought I would repeat the above on the laptop supplied by my client

1) installed the last verison of NVM4W installer (1.17.4)

2) set the proxy url

nvm proxy myclientproxy.com:xxxx

位 nvm install 8.12.0
Downloading node.js version 8.12.0 (64-bit)...
Complete
Downloading npm version 6.4.1... Download failed. Rolling Back.
Rollback failed. remove C:\Users\Daniel\AppData\Roaming\nvm\temp\npm-v6.4.1.zip: The process cannot access the file because it is being used by another process.
Could not download npm for node v8.12.0.
Please visit https://github.com/npm/cli/releases/tag/v6.4.1 to download npm.
It should be extracted to C:\Users\Daniel\AppData\Roaming\nvm\v8.12.0

Any advice on how resolve this or perform a manual install.

I had Nodist installed prior to nvm-windows. It left a .npmrc file under home directory (%userprofile%). I had to remove it and try nvm use command again to get everything right.

I don't know that my path had anything incorrect or missing, but re @ismailkattakath's solution, I also had extra .npmrc files laying around (in two places), and deleting them and attemting an npm install buzzphraze -g command worked and installed the package in the right place. Before this it was maddeningly creating a c\blar\mcblar\ folder structure in my drive root (in Windows).

Edit: on windows 7. For which the extras installs fails (and I got chocolatey installed through manual wrangling) because it is coded for powershell 1 but chocolately now requires TLS2 and powershell 5 to install. I wonder if the extras installs failures created .npmrc files in the wrong places.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fredericrous picture fredericrous  路  3Comments

hsali picture hsali  路  4Comments

Miggleness picture Miggleness  路  6Comments

tomByrer picture tomByrer  路  4Comments

webspecialist picture webspecialist  路  5Comments