To get started, we're going to create a new folder called global-modules and set the npm prefix to it: mkdir ~/.global-modules npm config set prefix "~/.global-modules" Next, if you don't already have a file called ~/.profile, create one in your root user directory. And lastly, there is always the ability to set parameters via npm config set. Use --json to show the settings in json format. Configuration appended to other commands like this does not persist everywhere, so it can become tiresome to set an array of configurations via the CLI. I have found a solution by manually removing the .npmrc file and reissuing the command. It does the management of configuration files that npm uses, but importantly, does not define all the configuration defaults or types, as those parts make more sense to live within the npm CLI itself. Note: This will only work when you run your project through an npm script (i.e. If value is omitted, then it sets it to "true". Installation. npm config set key value Sets the config key to the value. list npm config list Show all the config settings. For example, if a package has version 1.2.4, by default its version is set to ^1.2.4 which will allow minor upgrades for that package, but after you run npm config set save-prefix='~' it will be set to ~1.2.4 which only will only allow patch upgrades. not ok code 0 Note that you will have to repeat the same procedure with every node version, the prefix is set back to (in my case) /usr/local after installation. Configuration management for the npm cli. When I tried npm config delete prefix or nvm use --delete-prefix before using npm --prefix="" set prefix "", I got only: npm ERR! Any environmental variable set with the npm_config_ prefix will be used to configure npm. For example if a package has version 1.2.3, by default its version is set to ^1.2.3 which allows minor upgrades for that package, but after npm config set save-prefix='~' it would be set to ~1.2.3 which only allows patch upgrades. Now, add the following line to the ~/.profile file: Also, look at this as well as this. Wrapping It Up. – Giacomo1968 Mar 31 '19 at 3:56. Notice the prefix npm_package_config_, which tells Node where to get the variable from. It is not uncommon to need or desire to work in different versions of nodejs.A preferred method among node users is to use NVM (Node Version Manager). Install the nodejs package. To do that create a new directory in your home folder: I am trying to run another NodeJS version with nvm but getting this error: $ nvm use v4.2.4 nvm is not compatible with the npm config "prefix" option: currently set to "/Users/z/.npm-global" Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it. Use -l to also show defaults. 1 @JakeGould Thanks for the links! What is the output of npm config get prefix? @npmcli/config. npm config set. In those cases, it may be better to set configuration using environmental variables. In this quick tutorial, you learnt how to install the required npm dependencies from behind a proxy server. get npm config get key Echo the config value to stdout. $ npm config get prefix /usr This is the prefix we want to change, in order to install global packages in our home directory. This module is the spiritual descendant of npmconf, and the code that once lived in npm's lib/config/ folder. There are LTS releases too: nodejs-lts-fermium - For 14.X version; nodejs-lts-erbium - For 12.X version; nodejs-lts-dubnium - For 10.X version; Alternate installations. I have set the prefix on purpose to avoid the sudo npm . not just using node index.js). Once you have set the above configurations, you should be able to install the npm dependencies from behind a proxy server. You might encounter this issue while working on Angular or Node projects from behind a proxy server. $ nvm use v4.2.4 nvm is not compatible with the npm config "prefix" option: currently set to "/Users/z/.npm-global"Run `npm config delete prefix` or `nvm use --delete-prefix v4.2.4` to unset it. How can I use nvm without losing the prefix for my globally installed packages?