Making Global NPM packages available to all users on windows 2012 server

Had the same issue. Needed the CI build agent to run a global package on the CLI. Saw this post in a new feature request for system-wide npm -g for Windows.

In short:

  1. Open an administrator level command prompt
  2. Note the current global prefix: npm prefix -g
  3. Set the global prefix to the CI user: npm config set prefix <C:\Users\CI_USER\AppData\Roaming\npm>
  4. Install the needed packages: npm i -g PKG
  5. Restore the prefix to the previous value.

Leave a Comment