DEV Community

RajeshKumarYadav.com
RajeshKumarYadav.com

Posted on • Updated on

Node.js : NPM Behind A Proxy Server

If your internet access is through a proxy server, you might need to modify npm install commands that access remote repositories. npm uses a configuration file which can be updated via command line:

npm config set
Enter fullscreen mode Exit fullscreen mode

You can locate your proxy settings from your browser's settings panel. Once you have obtained the proxy settings (server URL, port, username and password); you need to configure your npm configurations as follows.

$ npm config set proxy http://<username>:<password>@<proxy-server-url>:<port>
$ npm config set https-proxy http://<username>:<password>@<proxy-server-url>:<port>
Enter fullscreen mode Exit fullscreen mode

username, password, port fields are optional. Once you have set these, your npm install, npm i -g etc. would work properly.

Buy Me A Coffee

With all that being said, I highly recommend you keep learning!

Thank you for reading this article. Please feel free to connect with me on LinkedIn and Twitter.

Discussion (0)