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:
- Open an administrator level command prompt
- Note the current global prefix:
npm prefix -g - Set the global prefix to the CI user:
npm config set prefix <C:\Users\CI_USER\AppData\Roaming\npm> - Install the needed packages:
npm i -g PKG - Restore the prefix to the previous value.