cantonjs / wxapp-boilerplate

使用 webpack, babel, scss 开发的微信/支付宝小程序项目脚手架
378 stars 60 forks source link

npm run build 出错,怎么办哟 #35

Open edenYfb opened 6 years ago

edenYfb commented 6 years ago

D:\myProject\abc\wxapp-boilerplate-master>npm run build

wxapp-boilerplate@0.0.0 prebuild D:\myProject\abc\wxapp-boilerplate-master rimraf dist

wxapp-boilerplate@0.0.0 build D:\myProject\abc\wxapp-boilerplate-master run-s build:*

wxapp-boilerplate@0.0.0 build:wechat D:\myProject\abc\wxapp-boilerplate-master cross-env NODE_ENV=production webpack --env.target=Wechat --env.min

TypeError: Cannot read property 'replace' of undefined at D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\NormalModuleFactory.js:106:27 at D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\NormalModuleFactory.js:59:4 at applyPluginsAsyncWaterfall (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\NormalModuleFactory.js:236:4) at D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\node_modules\tapable\lib\Tapable.js:268:11 at IgnorePlugin.checkIgnore (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\IgnorePlugin.js:56:10) at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\node_modules\tapable\lib\Tapable.js:272:13) at NormalModuleFactory.create (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\NormalModuleFactory.js:220:8) at semaphore.acquire (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compilation.js:407:18) at Semaphore.acquire (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\util\Semaphore.js:16:4) at Compilation._addModuleChain (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compilation.js:406:18) at Compilation.addEntry (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compilation.js:494:8) at Compiler.compiler.plugin (D:\myProject\abc\wxapp-boilerplate-master\node_modules\wxapp-webpack-plugin\lib\index.js:460:16) at Compiler.applyPluginsParallel (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\node_modules\tapable\lib\Tapable.js:293:14) at applyPluginsAsync.err (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compiler.js:499:9) at Compiler.applyPluginsAsyncSeries (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\node_modules\tapable\lib\Tapable.js:195:46) at Compiler.compile (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compiler.js:492:8) at readRecords.err (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compiler.js:279:11) at Compiler.readRecords (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compiler.js:391:11) at applyPluginsAsync.err (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\Compiler.js:276:10) at next (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\node_modules\tapable\lib\Tapable.js:202:11) at Compiler.compiler.plugin (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\lib\CachePlugin.js:51:59) at next (D:\myProject\abc\wxapp-boilerplate-master\node_modules\webpack\node_modules\tapable\lib\Tapable.js:204:14) at Compiler. (D:\myProject\abc\wxapp-boilerplate-master\node_modules\wxapp-webpack-plugin\lib\index.js:93:6) at Generator.next () at step (D:\myProject\abc\wxapp-boilerplate-master\node_modules\wxapp-webpack-plugin\lib\index.js:42:191) at D:\myProject\abc\wxapp-boilerplate-master\node_modules\wxapp-webpack-plugin\lib\index.js:42:361 at at process._tickCallback (internal/process/next_tick.js:160:7) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! wxapp-boilerplate@0.0.0 build:wechat: cross-env NODE_ENV=production webpack --env.target=Wechat --env.min npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the wxapp-boilerplate@0.0.0 build:wechat script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Eden\AppData\Roaming\npm-cache_logs\2018-08-24T04_19_18_604Z-debug.log ERROR: "build:wechat" exited with 1. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! wxapp-boilerplate@0.0.0 build: run-s build:* npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the wxapp-boilerplate@0.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

edenYfb commented 6 years ago

我的是一个原生开发的小程序,准备用webpack去build一下,复制到wxapp-boilerplate的src下替换了里边内容,打包出的问题。。

Cap32 commented 6 years ago

请问你的 webpack 和 node.js 版本分别是多少?是使用 yarn 安装还是 npm 安装?