Search code examples
node.jsgruntjsnpmgrunt-contrib-imageminimagemin

Cannot install grunt-contrib-imagemin in Windows 8.1


I cannot install grunt-contrib-imagemin on my Windows 8.1 machine.

I have Node version 0.10.33. I have npm version 1.4.28. They are both fresh installations.

I was following this tutorial to setup Grunt to manage SASS, JS and images in a Laravel project.

I installed grunt-contrib-sass, grunt-contrib-uglify fine and then proceeded to try and install grunt-contrib-imagemin using the following command as found on the offical GitHub page:

npm install grunt-contrib-imagemin --save-dev

It gives me a weird warning to begin with:

npm WARN package.json [email protected] No repository field.
npm WARN engine [email protected]: wanted: {"node":">=0.10.0","npm":">=2.1.5"} (current: {"node":"0.10.33","npm":"1.4.28"})

So I thought maybe my npm is out of date so I uninstalled and reinstalled numerous times.

Then I decided to leave it to see if it works anyway regardless of the error and then this happens:

npm WARN engine [email protected]: wanted: {"node":">=0.10.0","npm":">=2.1.5"} (current: {"node":"0.10.33","npm":"1.4.28"})
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm ERR! EEXIST, open 'C:\Users\Daniel\AppData\Roaming\npm-cache\f0f75a32-m-cache-lodash-2-4-1-package-tgz.lock'
File exists: C:\Users\Daniel\AppData\Roaming\npm-cache\f0f75a32-m-cache-lodash-2-4-1-package-tgz.lock
Move it away, and try again.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "instal
l"
npm ERR! cwd C:\xampp\htdocs\rent1
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\Daniel\AppData\Roaming\npm-cache\f0f75a32-m-cache-lodash-2-4-1-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! not ok code 0

I have no idea why I can't install it. I tried it on my Windows 7 machine at work and it worked fine with the same Node and NPM installs.


Solution

  • Upgrade npm to latest.

    Lots of bugs fixed there.

    It's different on different machines because of race conditions. Speed makes a difference.