Yeoman gifsicle error (and others)

2019-04-29 02:32发布

问题:

I'm getting the following error while trying to do yo angular:

There are other error messages as well, during scaffolding.

I did:

npm install -g yo npm install -g generator-angular yo angular

I also tried doing npm install after it failed.

I also tried using yo webapp.

Here is the error:

> optipng-bin@0.3.1 postinstall C:\Users\SR71042\Documents\yeoman-app\node_modul
es\grunt-contrib-imagemin\node_modules\optipng-bin
> node lib/check.js


events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)

> jpegtran-bin@0.2.3 postinstall C:\Users\SR71042\Documents\yeoman-app\node_modu
les\grunt-contrib-imagemin\node_modules\jpegtran-bin
> node lib/check.js


module.js:340
    throw err;
          ^
Error: Cannot find module 'chalk'
    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.<anonymous> (C:\Users\SR71042\Documents\yeoman-app\node_modules\gr
unt-contrib-imagemin\node_modules\jpegtran-bin\lib\check.js:4:13)
    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 Function.Module.runMain (module.js:497:10)

> gifsicle@0.1.4 postinstall C:\Users\SR71042\Documents\yeoman-app\node_modules\
grunt-contrib-imagemin\node_modules\gifsicle
> node lib/check.js



module.js:340
    throw err;
          ^
Error: Cannot find module 'C:\Users\SR71042\Documents\yeoman-app\node_modules\gr
unt-contrib-imagemin\node_modules\gifsicle\lib\check.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
npm ERR! EEXIST, mkdir 'C:\Users\SR71042\Documents\yeoman-app\node_modules\grunt
-contrib-imagemin\node_modules\pngquant-bin\node_modules\bin-wrapper\node_module
s\mout\src\string'
File exists: C:\Users\SR71042\Documents\yeoman-app\node_modules\grunt-contrib-im
agemin\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\mout\src\
string
Move it away, and try again.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\SR71042\Documents\yeoman-app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path C:\Users\SR71042\Documents\yeoman-app\node_modules\grunt-contrib-i
magemin\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\mout\src
\string
npm ERR! fstream_path C:\Users\SR71042\Documents\yeoman-app\node_modules\grunt-c
ontrib-imagemin\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\
mout\src\string\repeat.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst
ream\lib\writer.js:171:23
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\mkd
irp\index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: EPERM, rmdir 'C:\Users\SR71042\Documents\yeom
an-app\node_modules\grunt-contrib-imagemin\node_modules\gifsicle\node_modules\bi
n-wrapper\node_modules\download\node_modules\request\node_modules\form-data\node
_modules\combined-stream'
npm ERR! error rolling back  gifsicle@0.1.4 { [Error: EPERM, rmdir 'C:\Users\SR7
1042\Documents\yeoman-app\node_modules\grunt-contrib-imagemin\node_modules\gifsi
cle\node_modules\bin-wrapper\node_modules\download\node_modules\request\node_mod
ules\form-data\node_modules\combined-stream']
npm ERR! error rolling back   errno: 50,
npm ERR! error rolling back   code: 'EPERM',
npm ERR! error rolling back   path: 'C:\\Users\\SR71042\\Documents\\yeoman-app\\
node_modules\\grunt-contrib-imagemin\\node_modules\\gifsicle\\node_modules\\bin-
wrapper\\node_modules\\download\\node_modules\\request\\node_modules\\form-data\
\node_modules\\combined-stream' }
npm ERR! error rolling back Error: EPERM, rmdir 'C:\Users\SR71042\Documents\yeom
an-app\node_modules\grunt-contrib-imagemin\node_modules\jpegtran-bin\node_module
s\bin-wrapper\node_modules\download\node_modules\request\node_modules\form-data\
node_modules\combined-stream'
npm ERR! error rolling back  grunt-contrib-imagemin@0.3.0 { [Error: EPERM, rmdir
 'C:\Users\SR71042\Documents\yeoman-app\node_modules\grunt-contrib-imagemin\node
_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_module
s\request\node_modules\form-data\node_modules\combined-stream']
npm ERR! error rolling back   errno: 50,
npm ERR! error rolling back   code: 'EPERM',
npm ERR! error rolling back   path: 'C:\\Users\\SR71042\\Documents\\yeoman-app\\
node_modules\\grunt-contrib-imagemin\\node_modules\\jpegtran-bin\\node_modules\\
bin-wrapper\\node_modules\\download\\node_modules\\request\\node_modules\\form-d
ata\\node_modules\\combined-stream' }
npm ERR! optipng-bin@0.3.1 postinstall: `node lib/check.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the optipng-bin@0.3.1 postinstall script.
npm ERR! This is most likely a problem with the optipng-bin 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 optipng-bin
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\SR71042\Documents\yeoman-app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\SR71042\Documents\yeoman-app\npm-debug.log
npm ERR! not ok code 0

C:\Users\SR71042\Documents\yeoman-app>

Anyone has any ideas?

回答1:

It maybe grunt-contrib-imagemin version ~0.8 has some errors.

Change your dependencies grunt-contrib-imageim to 0.7.1 in package.json

It will solve this problem



回答2:

I have the same problem and I have resolve it with edit my package.json file. In the devDependencies, I have upgrade the version of jpegtran-bin 0.2.0 to 0.2.6. After that, I have launch npm install and now it's OK.

I hope that will help you to solve your problem.



回答3:

If you get an error like "cannot find module 'imagemin-gifsicle'" then you might need to modify the dev dependencies of "grunt-contrib-imagemin" as "^0.7.1" in package.json. Then run "npm install".

This solved the error for me.



回答4:

Try running npm install -g npm@2



标签: yeoman