npm install --save express在OSX Yosemite

时间:2015-09-20 20:05:04

标签: node.js command-line proxy npm

  

我安装了Node(v4.1.0)和npm(2.14.3),但是当我尝试输入命令时:

npm install --save express 
  

我收到以下错误消息:

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "express"
npm ERR! node v4.1.0
npm ERR! npm  v2.14.3
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo

npm ERR! network getaddrinfo ENOTFOUND host host:80
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! Please include the following file with any support request:
npm ERR!     /Users/Christopher_Pelnar/npm-debug.log
  

任何人都有处理此问题的经验或想法?我尝试使用以下方法配置代理设置:

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

但这并没有解决问题。

1 个答案:

答案 0 :(得分:0)

  

将以下代码添加到命令行中解决了问题:

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

更改“注册表”=> “代理”是不同的。