Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
450 views
in Technique[技术] by (71.8m points)

node.js - bower behind a proxy

bower install behind a proxy fails in timeout with the following settings (some set are useless...) :

git config --global http.proxy fr-proxy.example.com:3128
git config --global https.proxy fr-proxy.example.com:3128

export http_proxy=http://fr-proxy.example.com:3128
export https_proxy=http://fr-proxy.example.com:3128

npm config set proxy http://fr-proxy.example.com:3128
npm config set https-proxy http://fr-proxy.example.com:3128

npm config set registry http://registry.npmjs.org/

I have also tried an install/uninstall of bower and a bower clean cache.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Edit your .bowerrc file and add the wanted proxy configuration:

{
    "proxy":"http://<host>:<port>",
    "https-proxy":"http://<host>:<port>"
}

If working behind an authenticated proxy, user and password should be included like this:

{
    "proxy":"http://<user>:<password>@<host>:<port>",
    "https-proxy":"http://<user>:<password>@<host>:<port>"
}

Usually, the .bowerrc is next to the bower.json. And if there is no .bowerrc file near the bower.json file, you can create one by yourself.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...