解决vue中使用vue-cli脚手架创建项目报错sockjs.js?9be2:1606 GET
创建好项目后,用npm run serve运行项目时,运行后console控制台总报sockjs.js?9be2:1606 GET http://localhost:8080/sockjs-node/info?t=1581148413474 net::ERR_CONNECTI这个错误不停的刷新
在 vue.config.js 中 找到 devServer 中的 代理服务 proxy,将 ws设置为 false ,保存以后 重新启动服务,然后在浏览器中刷新 再去开发者工具中, 看console 中就没有报错了。
devServer: {
open: true,
port: 8080,
proxy: {
'/api': {
target: 'https://xxxxxx.com',
ws: false, //设置为 fasle 就行
changOrigin: true,
pathRewrite:{
'^/api':''
}
},