gpt4 book ai didi

vue.js - 我可以在 Vue 中将默认端口从 8080 更改为其他端口吗?

转载 作者:行者123 更新时间:2023-12-03 06:43:01 24 4
gpt4 key购买 nike

我一直在使用 Vue.js 和 Node.js 来构建我的应用程序。当我开始使用 Vue 时,它​​默认在 8080 上运行,而 Node 我在 3008 上运行。

我想要做的是由于某些情况,我想将 Vue 的端口从 8080 更改为任何其他端口,例如 8086 或 3005。我该怎么做?

最佳答案

只需运行以下命令即可根据所需端口运行 vue app:

npm run serve --port 8086



另一种方法是更新您的 package.json 中的服务脚本命令。文件。只需追加 --port 8086像这样:
"scripts": {
"serve": "vue-cli-service serve --port 8086",
"build": "vue-cli-service build",
"inspect": "vue-cli-service inspect",
"lint": "vue-cli-service lint"
}

关于vue.js - 我可以在 Vue 中将默认端口从 8080 更改为其他端口吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58231253/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com