执行npm run build
时报node_modules/optipng-bin/vendor/optipng ENOENT
这个错误
日志如下
15:02:26 events.js:183
15:02:26 throw er; // Unhandled 'error' event
15:02:26 ^
15:02:26 Error: spawn node_modules/_optipng-bin@3.1.4@optipng-bin/vendor/optipng ENOENT
15:02:26 at _errnoException (util.js:1024:11)
15:02:26 at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
15:02:26 at onErrorNT (internal/child_process.js:372:16)
15:02:26 at _combinedTickCallback (internal/process/next_tick.js:138:11)
15:02:26 at process._tickCallback (internal/process/next_tick.js:180:9)
15:02:26 npm ERR! code ELIFECYCLE
15:02:26 npm ERR! errno 1
15:02:26 npm ERR! development@1.0.6 build: `export NODE_ENV=production && webpack --display-error-details --config webpack.config.js && gulp check-code && gulp build`
15:02:26 npm ERR! Exit status 1
15:02:26 npm ERR!
15:02:26 npm ERR! Failed at the development@1.0.6 build script.
15:02:26 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
15:02:26
15:02:26 npm ERR! A complete log of this run can be found in:
https://github.com/panteng/wechat-h5-boilerplate/issues/5
执行下面的命令卸载重装 gulp-imagemin
依赖即可,需要注意版本区别
npm install node-gyp
npm uninstall gulp-imagemin
npm install gulp-imagemin
我的版本是4.1.0
就执行npm install gulp-imagemin@4.1.0
安装, npm rebuild
命令说不定也有帮助,根据自己情况决定是否删除node_modules