开发者

NPM Cannot Work! "Error: ECONNREFUSED, Could not contact DNS servers"

开发者 https://www.devze.com 2023-03-11 16:50 出处:网络
When I type \"npm install express\",It show these tips. soasme@ubuntu:~/Desktop/nodeex$ npm install express

When I type "npm install express",It show these tips.

soasme@ubuntu:~/Desktop/nodeex$ npm install express
npm ERR! Error: ECONNREFUSED, Could not contact DNS servers
npm ERR!     at IOWatcher.callback (dns.js:74:15)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Linux 2.6.38-8-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "express"
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/soasme/Desktop/nodeex/npm-debug.log
npm not ok

Is there any thing can do help to it? I was confused about the "DNS server". Is this means I cannot resolve the url of update? The log file is written belows:

info it worked if it ends with ok
verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'express' ]
info using npm@1.0.9
info using node@v0.4.8
verbose config file /home/soasme/.npmrc
verbose config file /usr/local/etc/npmrc
verbose into /home/soasme/Desktop/nodeex [ 'express' ]
verbose cache add [ 'express', null ]
info addNamed [ 'express', '' ]
verbose addNamed [ null, '' ]
verbose GET express
verbose raw, before any munging express
verbose url resolving [ 'http://registry.npmjs.org/', './express' ]
verbose url resolved http://registry.npmjs.org/express
verbose url parsed { protocol: 'http:',
verbose url parsed   slashes: true,
verbose url parsed   host: 'registry.npmjs.org',
verbose url parsed   hostname: 'registry.npmjs.org',
verbose url parsed   href: 'http://registry.npmjs.org/express',
verbose url parsed   pathname: '/express' }
ERR! Error: ECONNREFUSED, Could not contact DNS servers
ERR!  开发者_如何学运维   at IOWatcher.callback (dns.js:74:15)
ERR! Report this *entire* log at:
ERR!     <http://github.com/isaacs/npm/issues>
ERR! or email it to:
ERR!     <npm-@googlegroups.com>
ERR! 
ERR! System Linux 2.6.38-8-generic
ERR! command "node" "/usr/local/bin/npm" "install" "express"
verbose exit [ 11, true ]


that default use proxy http://127.0.0.1.8087

so execute:

npm config set proxy null


vi /etc/resolv.conf, and add a line "nameserver 8.8.8.8". Then it work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号