欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ERROR Invalid options in vue.config.js: "publicPath" is not allowed

程序员文章站 2022-07-14 23:45:41
...

刚从远程clone下来的代码,npm run dev后报错,报错信息如下:

 ERROR  Invalid options in vue.config.js: "publicPath" is not allowed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aaa@qq.com dev: `vue-cli-service serve --open`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the aaa@qq.com dev 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!     /Users/thinker/.npm/_logs/2019-10-11T03_32_39_690Z-debug.log

ERROR Invalid options in vue.config.js: "publicPath" is not allowed

解决方式:
具体原因是因为版本支持的问题,publicPath 属性到 vue-cli 3.2.0 之后才支持,所以将 publicPath 改成 baseUrl 即可,或者升级你的 vue-cli 。

修改前:
ERROR Invalid options in vue.config.js: "publicPath" is not allowed
修改后:
ERROR Invalid options in vue.config.js: "publicPath" is not allowed