title: NPM Installation error - "weird error 8", "throw er;"
body: <p>when I try to install <a href="https://github.com/gruntjs/grunt-contrib-imagemin" rel="nofollow">grunt-contrib-imagemin@0.4.1</a> I get these errors (in the terminal);</p>
  
  <pre><code>&gt; optipng-bin@0.3.1 postinstall /Users/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin
  &gt; 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/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/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
  
  &gt; gifsicle@0.1.4 postinstall /Users/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/server/public/angular/node_modules/grunt-contrib-imagemin/node_modules/gifsicle
  &gt; 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/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/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/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/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!     &lt;http://github.com/isaacs/npm/issues&gt;
  npm ERR! or email it to:
  npm ERR!     &lt;npm-@googlegroups.com&gt;
  
  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/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/server/public/angular
  npm ERR! node -v v0.10.13
  npm ERR! npm -v 1.3.2
  npm ERR! path /Users/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/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
  </code></pre>
  
  <p>The <code>npm-debug.log</code> file looks like this;</p>
  
  <pre><code>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     &lt;http://github.com/isaacs/npm/issues&gt;
  16118 error or email it to:
  16118 error     &lt;npm-@googlegroups.com&gt;
  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/&lt;omitted&gt;/Workspace/&lt;omitted&gt;/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 ]
  </code></pre>
  
  <p>What's wrong? The weird thing is that I had <code>grunt-contrib-imagemin</code> installed earlier today but uninstalled it in order to get <code>0.4.1</code> instead of <code>0.5.0</code>. Now I can't reinstall any versions at all. </p>
  
  <p>I did a </p>
  
  <pre><code>rm -rd node_modules/
  npm install
  </code></pre>
  
  <p>just to clean the node_modules folder. Still not working.</p>