How to configure NPM and Yarn behind proxy server

Introduction

Here we will configure Npm or Yarn to access internet through proxy server.

Steps

1. Open an command prompt or terminal session and type the following commands [enlighter] npm config set proxy http://proxyserver:proxyport npm config set https-proxy http://proxyserver:proxyport npm config set strict-ssl false npm config set registry “http://registry.npmjs.org/” npm –without-ssl –insecure install [/enlighter] Where proxyserver is your proxy server IP address and proxyport is your proxy server Port number.
For example: http://10.1.1.1:3128

For YARN, you need also to run this command [enlighter] yarn config set strict-ssl false [/enlighter]
2. Check Node Configuration by writing the following command [enlighter] npm config list [/enlighter] The output will look like this: [enlighter] ; cli configs metrics-registry = “https://registry.npmjs.org/” scope = “” user-agent = “npm/6.10.1 node/v10.16.0 win32 x64” ; userconfig C:\Users\Armano\.npmrc https-proxy = “http://proxyserver/:proxyport” proxy = “http://proxyserver/:proxyport” ; builtin config undefined prefix = “C:\\Users\\User1\\AppData\\Roaming\\npm” ; node bin location = C:\Program Files\nodejs\node.exe ; cwd = C:\Windows\System32 ; HOME = C:\Users\User1 ; “npm config ls -l” to show all defaults. [/enlighter]
 Make sure that all proxy configuration is correct, and that’s all, you can now use Npm/Yarn behind proxy server

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
AffiliateLabz Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
AffiliateLabz
Guest

Great content! Super high-quality! Keep it up! 🙂