安装节点包的错误

时间:2014-01-15 19:30:07

标签: node.js package npm

这可能是一个noob问题,但我真的感到困惑和沮丧。许多npm装置是否真的有缺陷或者我错过了什么?

这次我试过

npm install grunt-contrib-imagemin -g

,结果是

...
npm http 304 http://registry.npmjs.org/cryptiles
npm http 304 http://registry.npmjs.org/graceful-fs

> gifsicle@0.1.4 postinstall /usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/gifsicle
> node lib/check.js


events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: connect ECONNREFUSED
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

> optipng-bin@0.3.1 postinstall /usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/optipng-bin
> node lib/check.js



module.js:340
    throw err;
          ^
Error: Cannot find module 'json-stringify-safe'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object. (/usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/optipng-bin/node_modules/bin-wrapper/node_modules/download/node_modules/request/request.js:19:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
npm ERR! EEXIST, mkdir '/usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/jpegtran-bin/node_modules/bin-wrapper/node_modules/mout/random'
File exists: /usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/jpegtran-bin/node_modules/bin-wrapper/node_modules/mout/random
Move it away, and try again. 
npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-contrib-imagemin" "-g"
npm ERR! cwd /Users/dmitrizaitsev/Dropbox/Priv/APP
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! path /usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/jpegtran-bin/node_modules/bin-wrapper/node_modules/mout/random
npm ERR! fstream_path /usr/local/lib/node_modules/grunt-contrib-imagemin/node_modules/image-min/node_modules/jpegtran-bin/node_modules/bin-wrapper/node_modules/mout/random/randInt.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! gifsicle@0.1.4 postinstall: `node lib/check.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the gifsicle@0.1.4 postinstall script.
npm ERR! This is most likely a problem with the gifsicle package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/check.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls gifsicle
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-contrib-imagemin" "-g"
npm ERR! cwd /Users/dmitrizaitsev/Dropbox/Priv/APP
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/dmitrizaitsev/Dropbox/Priv/APP/npm-debug.log
npm ERR! not ok code 0

有关这里发生的事情的任何帮助吗?

1 个答案:

答案 0 :(得分:2)

npm不时有问题。它提供了很多要求。今天的例子:https://twitter.com/PeteRomano/status/423506485188911105

造成这种情况的原因也可能导致您的问题。你最近再试过吗?

编辑:修正了一个拼写错误