0

每次我尝试用 NPM 做某事时,它都不起作用。我已经安装了 nodeversion 0.10.7和 npm version 1.2.21。我需要安装咖啡脚本,它给了我这个错误:

npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm ERR! network tunneling socket could not be established, cause=getaddrinfo ENOTFOUND
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! System Linux 3.5.0-39-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! cwd /home/sasuke/Videos/Node.js/Ex_Files_Node.js_FL/Exercise Files/3 Modules
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! code ECONNRESET
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sasuke/Videos/Node.js/Ex_Files_Node.js_FL/Exercise Files/3 Modules/npm-debug.log
npm ERR! not ok code 0

我看到了这个链接: https ://github.com/isaacs/npm/issues/2677 但是在我尝试检查代理后我得到了这个:

~ > npm config get proxy
proxy-url:port
~ > npm config get https-proxy
proxy-url:port

后来在那篇文章中,有人说要更改令牌/usr/local/etc/npmrc但我没有那个文件。之后我将节点更新为v0.10.18但我仍然有同样的错误。我正在使用 Ubuntu 12.04,但我仍然不知道如何解决这个问题。请帮忙。

已编辑的问题:我已删除npm proxy并且npm https-proxy现在已安装咖啡脚本,但显示了一些警告

sudo npm install -g coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.3.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.3.tgz
/usr/local/bin/coffee -> /usr/local/lib/node_modules/coffee-script/bin/coffee
/usr/local/bin/cake -> /usr/local/lib/node_modules/coffee-script/bin/cake
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/couch-login requires request@'~2.9.202' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request,
npm WARN unmet dependency which is version 2.25.0
coffee-script@1.6.3 /usr/local/lib/node_modules/coffee-script

在我输入咖啡后,它就存在并给了我 REPL 提示。即使在安装时出现这些警告,这是否仍能正常工作?

4

1 回答 1

2

解决方案在这里:

手动安装 NPM 包

npm set proxy $PROXY
npm set https-proxy $PROXY
于 2014-01-05T23:31:52.483 回答