尝试yo angular
时出现以下错误:
在脚手架中还有其他错误消息。
我做了:
npm install -g yo
npm install -g generator-angular
yo angular
我失败后也试过npm install
。
我也尝试过使用yo webapp
。
这是错误:
> 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>
任何人都有任何想法?
答案 0 :(得分:8)
可能grunt-contrib-imagemin
版 ~0.8 有一些错误。
在 package.json
中将您的依赖关系grunt-contrib-imageim
更改为0.7.1
它将解决这个问题
答案 1 :(得分:4)
我有同样的问题,我已经通过编辑我的package.json文件来解决它。 在devDependencies中,我将jpegtran-bin 0.2.0的版本升级到0.2.6。 之后,我启动了npm install,现在没问题。
我希望这能帮助您解决问题。
答案 2 :(得分:3)
如果出现“无法找到模块'imagemin-gifsicle'”这样的错误,那么您可能需要在package.json中将“grunt-contrib-imagemin”的dev依赖项修改为“^ 0.7.1”。然后运行“npm install”。
这解决了我的错误。
答案 3 :(得分:0)
尝试运行npm install -g npm@2