n this quick tutorial, you’ll learn how to install NPM dependencies from behind a proxy server. While working on an Angular project recently, I had to clone the source code and install the required dependencies. To my surprise, nothing worked as expected. Things are somewhat different when run try to install Node packages from behind a proxy server. You need to set the https-proxy, proxy and registry to install the dependencies.

Setting Npm Proxy Settings

From your command prompt, you can type in the following command to check the current npm settings.

npm config list

The above command will give you the npm config settings :

; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.12.1 node/v12.13.1 win32 x64"

; builtin config undefined
prefix = "C:\\Users\\Jay\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\Jay
; HOME = C:\Users\Jay
; "npm config ls -l" to show all defaults.

Now let’s set the required npm configurations.

npm config set proxy 
npm config set https-proxy 
npm config set registry http://registry.npmjs.org

Once you have set the above configurations, you should be able to install the npm dependencies from behind a proxy server.

Wrapping It Up

In this quick tutorial, you learnt how to install the required npm dependencies from behind a proxy server. You might encounter this issue while working on Angular or Node projects from behind a proxy server.