我正在尝试学习Nodejs,但每次尝试从NodeSchool安装模块时;特别是"如何节点" &安培; " learnyounode&#34 ;.我得到" ECONNREFUSED "当试图运行任何东西。任何人都可以解释为什么我一直这样做?顺便说一下,如果我正常运行或sudo,就会发生这种情况。
我假设它与代理设置有关,但我不确定如何修复它。从我阅读过的所有内容和我观看过的视频看来,我似乎都正确地遵循了说明。
bu2@pdouxdbu2:~$ npm install -g how-to-node
npm ERR! Error: connect ECONNREFUSED
npm ERR! at errnoException (net.js:905:11)
npm ERR! at Object.afterConnect [as oncomplete] (net.js:896:19)
npm ERR! { [Error: connect ECONNREFUSED]
npm ERR! code: 'ECONNREFUSED',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! syscall: 'connect' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Linux 3.11.0-26-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "how-to-node"
npm ERR! cwd /home/bu2
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! syscall connect
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! stack Error: connect ECONNREFUSED
npm ERR! stack at errnoException (net.js:905:11)
npm ERR! stack at Object.afterConnect [as oncomplete] (net.js:896:19)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/bu2/npm-debug.log
npm ERR! not ok code 0
bu2@pdouxdbu2:~$ sudo npm -g install how-to-node
[sudo] password for bu2:
npm ERR! Error: connect ECONNREFUSED
npm ERR! at errnoException (net.js:905:11)
npm ERR! at Object.afterConnect [as oncomplete] (net.js:896:19)
npm ERR! { [Error: connect ECONNREFUSED]
npm ERR! code: 'ECONNREFUSED',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! syscall: 'connect' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Linux 3.11.0-26-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "-g" "install" "how-to-node"
npm ERR! cwd /home/bu2
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! syscall connect
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! stack Error: connect ECONNREFUSED
npm ERR! stack at errnoException (net.js:905:11)
npm ERR! stack at Object.afterConnect [as oncomplete] (net.js:896:19)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/bu2/npm-debug.log
npm ERR! not ok code 0
bu2@pdouxdbu2:~$
答案 0 :(得分:-1)
npm config set proxy http://:proxyaddress:portnumber npm config set https-proxy http://proxyaddress:portnumber 首先运行这两个命令,然后安装。 它有效。