Then edit the "username", "password", and "proxy" fields in the code you pasted.Ĭheck your settings by running npm config list and cat ~/.npmrc Simply paste the following code at the bottom of your ~/.bashrc file: # User Variables (Edit These!) # username="myusername" password="mypassword" proxy="mycompany:8080" # Environement Variables # (npm does use these variables, and they are vital to lots of applications) # export export export export export export export export export no_proxy="127.0.0.10/8, localhost, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16" # npm Settings # npm config set registry npm config set proxy npm config set https-proxy npm config set strict-ssl false echo "registry=" > ~/.npmrc echo > ~/.npmrc echo "strict-ssl=false" > ~/.npmrc echo > ~/.npmrc echo > ~/.npmrc echo > ~/.npmrc echo > ~/.npmrc # WGET SETTINGS # (Bonus Settings! Not required for npm to work, but needed for lots of other programs) # echo "https_proxy = > ~/.wgetrc echo "http_proxy = > ~/.wgetrc echo "ftp_proxy = > ~/.wgetrc echo "use_proxy = on" > ~/.wgetrc # CURL SETTINGS # (Bonus Settings! Not required for npm to work, but needed for lots of other programs) # echo > ~/.curlrc So I added the following into my ~/.bashrc or ~/.bash_profile so that whenever I open a terminal, I know my npm is up to date! If your company is like mine, I have to change my password pretty often. Put your settings into ~/.bashrc or ~/.bash_profile so you don't have to worry about your settings everytime you open a new terminal window! When in doubt, try all these commands, as I do: npm config set registry npm config set proxy npm config set https-proxy npm config set strict-ssl false set set export export export npm -proxy \ -without-ssl -insecure -g install
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
June 2023
Categories |