- vue项目中出现Cannot GET / 报错
- redis报错:Cannot get Jedis connect
- vue启动服务Cannot GET /问题
- Vue项目npm run dev后 报错Cannot GET /
- Vega-Embed 在 Vue Typescript 项目中引
- vue 运行时报错: Cannot assign to read
- 向 Vue 项目中导入 element-ui 发生 Cannot
- VUE中 axios请求失败,TypeError: Cannot
- Error: Cannot find module 'array
- 【完美解决】Hexo博客出现“Cannot GET/xxx”错误
一定要记录下这个问题。。。。
vue项目,运行网页上出现 Cannot GET /
打开控制台 出现:Failed to load resource: the server responded with a status of 404 (Not Found)
整个人很懵,什么情况,我就是重启了下电脑。
先说下我的解决办法。
1. 首先,终端输入 ps -ef|grep node 查看哪些进程开着,把进程都kill掉 ,然后npm run dev ,没用。
2. 把node_modules文件删掉,重新用终端安装,
安装命令 :npm install
出现npm WARN webpack-cli@3.1.2 requires a peer of webpack@^4.x.x but none is ins**
这个是建议安装较低版本的webpack
输入命令:npm install webpack@3.0.0 -g
重新npm run dev ,依旧 Cannot GET/
3.为了排除是node的问题,我又重新init了一个新项目,没问题
4最后,我找到config里的index.js,
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: './',
proxyTable: {
'/list': { //将www.exaple.com印射为/api
target: 'http://39.105.189.240/', // 接口域名 http://39.105.189.240/api/
changeOrigin: true, //是否跨域
pathRewrite: {
'^/list': '/' //需要rewrite的,
}} },
把assetsPublicPath: './', 改成 assetsPublicPath: '/',
解决了,是路由的问题。
网友评论