vue3 启动项目 Network: unavailable,怎么改?
vue3 启动项目 Network: unavailable再 vue.config.js
改成:
module.exports = {
transpileDependencies: true,
public: '0.0.0.0:8080',
}
然后再启动项目就:
> vue_shop@0.1.0 serve C:\Vue\webroot\weishangcheng\vue_shop
> vue-cli-service serve
ERROR Invalid options in vue.config.js: "public" is not allowed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_shop@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_shop@0.1.0 serve 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\夕阳\AppData\Roaming\npm-cache\_logs\2023-06-06T15_05_07_388Z-debug.log
回复
1个回答

test
2024-07-02
module.exports = {
transpileDependencies: true,
devServer: {
host: '0.0.0.0',
port: 8080,
public: 'your.public.ip.address:8080', // 用你的公网IP地址或主机名
},
}
回复

适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容