使用有连接问题的npm管理器安装grunt

时间:2016-02-08 16:41:40

标签: node.js gruntjs npm-install

嘿我试图使用NPM管理器安装Grunt,我似乎有连接问题超时我在线搜索了一些。我可以点击这个网址https://registry.npmjs.org/grunt就好了,它会问我是否要保存或运行GRUNT.JSON,如果我剪切并粘贴该网址,我将在巨大的数组中看到该JSON的内容

GEL8953@VALGEL8953L MINGW64 ~/Dev/MillsDashboard/MillsDashboard (master)
$ npm install grunt grunt-cli -g
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/grunt-cli
npm ERR! Error: connect ETIMEDOUT
npm ERR!     at errnoException (net.js:901:11)
npm ERR!     at Object.afterConnect [as oncomplete] (net.js:892:19)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program      
Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt"    
"grunt-cli" "-g"
npm ERR! cwd C:\Users\GEL8953\Dev\MillsDashboard\MillsDashboard
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! syscall connect
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm

执行命令&#34; npm i grunt&#34;从项目根目录我得到以下

   GEL8953@VALGEL8953L MINGW64 ~/Dev/MillsDashboard/MillsDashboard (master)
   $ npm i grunt
   npm ERR! Error: Invalid name: "MillsDashbaord"
  npm ERR!     at ensureValidName (C:\Program Files     
  (x86)\nodejs\node_modules\npm\node_modu                                             
  les\read-package-json\node_modules\normalize-package-
  data\lib\fixer.js:281:15)
  npm ERR!     at Object.module.exports.fixNameField (C:\Program Files 
  (x86)\nodejs\node_mo                                             
  dules\npm\node_modules\read-package-json\node_modules\normalize-package-
  data\lib\fixer.js                                             :196:5)
  npm ERR!     at C:\Program Files 
  (x86)\nodejs\node_modules\npm\node_modules\read-package-                                             
  json\node_modules\normalize-package-data\lib\normalize.js:29:38
  npm ERR!     at Array.forEach (native)
  npm ERR!     at normalize (C:\Program Files 
  (x86)\nodejs\node_modules\npm\node_modules\re                                             
  ad-package-json\node_modules\normalize-package-  
  data\lib\normalize.js:28:15)
  npm ERR!     at final (C:\Program Files 
  (x86)\nodejs\node_modules\npm\node_modules\read-p                                             
  ackage-json\read-json.js:310:33)
  npm ERR!     at then (C:\Program Files 
  (x86)\nodejs\node_modules\npm\node_modules\read-pa                                             
  ckage-json\read-json.js:124:33)
  npm ERR!     at C:\Program Files 
  (x86)\nodejs\node_modules\npm\node_modules\read-package-                                             
  json\read-json.js:284:48
  npm ERR!     at fs.js:207:20
  npm ERR!     at Object.oncomplete (fs.js:107:15)
  npm ERR! If you need help, you may report this log at:
  npm ERR!     <http://github.com/isaacs/npm/issues>
  npm ERR! or email it to:
  npm ERR!     <npm-@googlegroups.com>

  npm ERR! System Windows_NT 6.1.7601
  npm ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program 
  Files (x86)\\no                                             
  dejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "grunt"
  npm ERR! cwd C:\Users\GEL8953\Dev\MillsDashboard\MillsDashboard
  npm ERR! node -v v0.10.13
  npm ERR! npm -v 1.3.2

1 个答案:

答案 0 :(得分:1)

您可能需要设置注册表:

npm set registry https://registry.npmjs.org/

卸载并清理缓存:

npm uninstall -g grunt-cli

npm cache clean

npm i -g grunt-cli

包含包含bin和控制器的MillsDashboard。

npm i grunt

你是否在防火墙后面?代理?