当我尝试安装grunt-contrib-imagemin@0.4.1时出现这些错误(在终端中);
> optipng-bin@0.3.1 postinstall /Users/<omitted>/Workspace/<omitted>/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin
> node lib/check.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: tunneling socket could not be established, cause=connect EHOSTUNREACH
at ClientRequest.onError (/Users/<omitted>/Workspace/<omitted>/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/node_modules/bin-wrapper/node_modules/download/node_modules/request/node_modules/tunnel-agent/index.js:159:17)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1528:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at Socket.onerror (tls.js:1424:17)
at Socket.EventEmitter.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:415:13)
unbuild optipng-bin@0.3.1
> gifsicle@0.1.4 postinstall /Users/<omitted>/Workspace/<omitted>/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/gifsicle
> node lib/check.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: tunneling socket could not be established, cause=connect EHOSTUNREACH
at ClientRequest.onError (/Users/<omitted>/Workspace/<omitted>/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/download/node_modules/request/node_modules/tunnel-agent/index.js:159:17)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1528:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at Socket.onerror (tls.js:1424:17)
at Socket.EventEmitter.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:415:13)
unbuild gifsicle@0.1.4
unbuild grunt-contrib-imagemin@0.4.1
npm ERR! Error: ENOENT, open '/Users/<omitted>/Workspace/<omitted>/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin/node_modules/bin-wrapper/node_modules/mout/src/math/isNear.js'
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 Darwin 13.1.0
npm ERR! command "/usr/local/Cellar/node/0.10.13/bin/node" "/usr/local/bin/npm" "install" "grunt-contrib-imagemin@0.4.1" "--save-dev"
npm ERR! cwd /Users/<omitted>/Workspace/<omitted>/server/public/angular
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! path /Users/<omitted>/Workspace/<omitted>/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin/node_modules/bin-wrapper/node_modules/mout/src/math/isNear.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! weird error 8
该npm-debug.log
文件如下所示;
16117 error Error: ENOENT, utime '/var/folders/1m/0y7hjtm94rdcpk3frnf43d2c0000gx/T/npm-69757/1395137735074-0.018615296110510826/package/README.md'
16118 error If you need help, you may report this log at:
16118 error <http://github.com/isaacs/npm/issues>
16118 error or email it to:
16118 error <npm-@googlegroups.com>
16119 error System Darwin 13.1.0
16120 error command "/usr/local/Cellar/node/0.10.13/bin/node" "/usr/local/bin/npm" "install" "grunt-contrib-imagemin@0.4.1" "--save-dev"
16121 error cwd /Users/<omitted>/Workspace/<omitted>/server/public/angular
16122 error node -v v0.10.13
16123 error npm -v 1.3.2
16124 error path /var/folders/1m/0y7hjtm94rdcpk3frnf43d2c0000gx/T/npm-69757/1395137735074-0.018615296110510826/package/README.md
16125 error fstream_path /var/folders/1m/0y7hjtm94rdcpk3frnf43d2c0000gx/T/npm-69757/1395137735074-0.018615296110510826/package/README.md
16126 error fstream_type File
16127 error fstream_class FileWriter
16128 error fstream_finish_call utimes
16129 error code ENOENT
16130 error errno 34
16131 error fstream_stack /usr/local/Cellar/node/0.10.13/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
16131 error fstream_stack Object.oncomplete (fs.js:107:15)
16132 verbose exit [ 34, true ]
怎么了?奇怪的是,我grunt-contrib-imagemin
今天早些时候安装了它,但为了获得0.4.1
而不是0.5.0
. 现在我根本无法重新安装任何版本。
我做了一个
rm -rd node_modules/
npm install
只是为了清理 node_modules 文件夹。还是行不通。