by Sai gowtham

How to npm install behind a proxy server

In this tutorial, we are going to learn about how to install the npm packages behind the (corporate) proxy server.

Setting the proxy configuration

For Http proxy:

Open your terminal and run the following command by replacing it with your proxy host and port.

npm config set proxy http://proxy_host:port

If your proxy contains username and password then you can run it like this:

npm config set proxy http://username:password@proxy.us.company:port

For Https proxy:

If your company provides you https proxy then you can use the following command:

npm config set https-proxy https://proxy.company.com:8080

username & password config:

npm config set https-proxy http://username:password@proxy.us.company:port

Now, you can install the npm packages behind the proxy by running an npm install <package-name> command.

npm install express

You can also read, how to clear a proxy in npm.

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
130,921 students enrolled
21 hours of video content
View Course