简体   繁体   English

vue.config.js (devServer) 未在 npm 运行服务中使用

[英]vue.config.js (devServer) not used in npm run serve

I'm trying to set up a reverse proxy on the development server for my VUE js webapp to get around the CORS issue that I was getting when I was trying to use my flask HTTP APIs with the vue js webapp.我正在尝试在开发服务器上为我的 VUE js webapp 设置反向代理,以解决我在尝试将 flask Z293C9EA246FF9985DC6F62A650 与 API vueF78 web 应用程序一起使用时遇到的CORS 问题

I did this by creating a vue.config.js file in the root of the project directory:我通过在项目目录的根目录中创建一个 vue.config.js 文件来做到这一点:

module.exports = {
  devServer: {
    proxy: 'http://localhost:5001/'
  }
}

when I run npm run serve, and try to use a REST API defined on port 5001 - I don't see the request going to port 5001, it uses the same port as the web app. when I run npm run serve, and try to use a REST API defined on port 5001 - I don't see the request going to port 5001, it uses the same port as the web app.

And there are no useful logs being written to stdout either to help me debug this.并且没有有用的日志被写入标准输出来帮助我调试它。

Has anyone come across this issue before?有没有人遇到过这个问题?

I had a similar issue and found that the port was already in use by another application and hence it was not going to the correct port.我遇到了类似的问题,发现该端口已被另一个应用程序使用,因此它没有转到正确的端口。 Once i shutdown the other app, it started working as expected.一旦我关闭了另一个应用程序,它就开始按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM