简体   繁体   中英

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 Rent@0.1.0 No repository field.
npm WARN engine imagemin@2.2.1: 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 imagemin@2.2.1: wanted: {"node":">=0.10.0","npm":">=2.1.5"} (current: {"node":"0.10.33","npm":"1.4.28"})
npm WARN optional dep failed, continuing imagemin-jpegtran@4.0.0
npm WARN optional dep failed, continuing imagemin-gifsicle@4.0.0
npm WARN optional dep failed, continuing imagemin-optipng@4.0.0
npm WARN optional dep failed, continuing imagemin-pngquant@4.0.0
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.

Upgrade npm to latest.

Lots of bugs fixed there.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM