Tencent / wepy

小程序组件化开发框架
https://wepyjs.gitee.io/wepy-docs/
Other
22.48k stars 3.05k forks source link

build发生错误 #2106

Open keyiis opened 5 years ago

keyiis commented 5 years ago

运行npm run build会提示下面的错误,编译好的应用也可以正常运行,这个错误会有影响吗?

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object
    at Module.require (internal/modules/cjs/loader.js:631:11)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.load (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\lib\loader.js:113:17)
    at Object.loadPlugin (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\lib\loader.js:131:24)
    at Object.checkPlugin (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\lib\compile.js:187:33)
    at Object.init (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\lib\compile.js:221:60)
    at Command.module.exports (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\lib\bin\wepy-build.js:11:24)
    at Command.listener (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:189:13)
    at Command.parseArgs (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\node_modules\commander\index.js:654:12)
    at Command.parse (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\node_modules\commander\index.js:474:21)
    at Object.<anonymous> (D:\work\nodejs\global_modules\modules\node_modules\wepy-cli\lib\bin\wepy.js:44:21)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

还有每次build时都会提示安装wepy-plugin-uglifyjs,为什么每次都要安装呢,上一次编译安装模块不会保存吗?

[WARNING] 找不到插件:wepy-plugin-uglifyjs。
[16:44:55] [信息] 检测到有效NPM包资源,正在尝试安装,请稍等。
Alohaliu commented 5 years ago

npm install wepy-plugin-imagemin --save-dev

安装这个吧。 weby初始化后,package.json文件里面少了 wepy-plugin-imagemin,导致每次npm run build 都会报错。 手动安装wepy-plugin-imagemin后,wepy-plugin-uglifyjs报错和The "id" argument must be of type string。。。。都会自动解决。