1

我在使用 yeoman 生成 Angular 应用程序时遇到问题。

Yeoman 似乎做得很好,但是当涉及到 bower install && npm install 时,它在运行 OptiPNG 测试时失败了。

我正在运行 OSX 10.8.3、Node 版本 0.8.18 以及最新版本的 NPM 和 yeoman。

> optipng-bin@0.2.5 postinstall /Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin
> node pre-build.js


> jpegtran-bin@0.1.7 postinstall /Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/jpegtran-bin
> node pre-build.js

npm http GET https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http GET https://registry.npmjs.org/uglify-js/1.2.5

  ✖ 4 of 3 tests failed:

  1) OptiPNG should return path to OptiPNG binary:

  AssertionError: false == true
      at args (/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/test/test-optipng-path.js:18:4)
      at ChildProcess.exithandler (child_process.js:544:7)
      at ChildProcess.EventEmitter.emit (events.js:99:17)
      at maybeClose (child_process.js:638:16)
      at Process._handle.onexit (child_process.js:680:5)

  2) OptiPNG should successfully proxy OptiPNG:

  AssertionError: false == true
      at args (/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/test/test-optipng-path.js:27:4)
      at ChildProcess.exithandler (child_process.js:544:7)
      at ChildProcess.EventEmitter.emit (events.js:99:17)
      at maybeClose (child_process.js:638:16)
      at Process._handle.onexit (child_process.js:680:5)

  3) OptiPNG should minify a .png:
     Error: ENOENT, no such file or directory 'test/minified.png'
      at Object.fs.statSync (fs.js:524:18)
      at /Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/test/test-optipng-path.js:43:20
      at ChildProcess.exithandler (child_process.js:544:7)
      at ChildProcess.EventEmitter.emit (events.js:99:17)
      at maybeClose (child_process.js:638:16)
      at Socket.ChildProcess.spawn.stdin (child_process.js:815:11)
      at Socket.EventEmitter.emit (events.js:96:17)
      at Socket._destroy.destroyed (net.js:358:10)
      at process.startup.processNextTick.process._tickCallback (node.js:244:9)

  4) OptiPNG "after all" hook:
     Error: ENOENT, no such file or directory 'test/minified.png'
      at Object.fs.unlinkSync (fs.js:582:18)
      at Context.binPath (/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/test/test-optipng-path.js:11:6)
      at Hook.Runnable.run (/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/node_modules/mocha/lib/runnable.js:213:32)
      at next (/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/node_modules/mocha/lib/runner.js:243:10)
      at Runner.hook (/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/node_modules/mocha/lib/runner.js:254:5)
      at process.startup.processNextTick.process._tickCallback (node.js:244:9)


pre-build test failed, compiling from source...
Fetching http://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.4/optipng-0.7.4.tar.gz...

  3 tests complete (232 ms)

pre-build test passed successfully, skipping build...
npm http 304 https://registry.npmjs.org/underscore.string
npm http 304 https://registry.npmjs.org/ncp
npm http 304 https://registry.npmjs.org/i
npm http 304 https://registry.npmjs.org/deep-equal
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm WARN prefer global bower@0.9.2 should be installed with -g
npm http 304 https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/zeparser/0.0.5
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/tinycolor
npm http GET https://registry.npmjs.org/options
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/zeparser/0.0.5
npm http 304 https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/sigmund

> ws@0.4.25 install /Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-karma/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/inherits
Done in /var/folders/jn/g1mkc1bx7090cm6269r6sbm40000gp/T/optipng-0.7.4

Building OptiPNG...

/Users/Keva161/Documents/Web Dev/Webapps/Angular/yo/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/build.js:64
                            throw err;
                                  ^
Error: Command failed:
    at ChildProcess.exithandler (child_process.js:540:15)
    at ChildProcess.EventEmitter.emit (events.js:99:17)
    at maybeClose (child_process.js:638:16)
    at Socket.ChildProcess.spawn.stdin (child_process.js:815:11)
    at Socket.EventEmitter.emit (events.js:96:17)
    at Socket._destroy.destroyed (net.js:358:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
npm ERR! weird error 1
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished
npm ERR! not ok code 0
4

2 回答 2

3

我不确定这是否会有所帮助......但我最近在yo. (注意:我当时没有在 OSX 上进行测试,而是在 windows 上进行测试。但根据我对错误的回忆,我认为问题是相同的。)

问题是我更新到了最新yo版本,并且我的 npm 缓存中还残留着一些东西。以下固定的东西:

npm uninstall -g yeoman
npm install -g yo
npm cache clean
npm update -g yo

完成此操作后,我yo angular在一个干净的目录中进行了测试,并且脚手架的创建没有错误。

于 2013-05-16T02:40:11.640 回答
1

我有一个类似的问题,在我的项目目录的根目录中尝试了各种运行“bower cache clean”的东西后解决了它。

于 2014-02-05T18:54:26.420 回答