npm run serve 遍历报错
来源:4-3 创建Vue CLI项目
慕仙8513709
3天前

idea终端报错信息如下:
INFO Starting development server…
DONE Compiled successfully in 3663ms 15:25:39
App running at:
- Local: http://localhost:8080/
- Network: unavailable
Note that the development build is not optimized.
To create a production build, run npm run build.
ERROR in src/router/index.ts:1:64
TS7016: Could not find a declaration file for module ‘vue-router’. ‘D:/JAVA/Project/TestProjects/wiki/web/node_modules/vue-router/index.js’ implicitly has an ‘any’ type.
Try npm i --save-dev @types/vue-router if it exists or add a new declaration (.d.ts) file containing declare module 'vue-router';
1 | import { createRouter, createWebHistory, RouteRecordRaw } from ‘vue-router’
| ^^^^^^^^^^^^
2 | import HomeView from '…/views/HomeView.vue’
3 |
4 | const routes: Array = [
Try npm i --save-dev @types/vue-router if it exists or add a new declaration (.d.ts) file containing declare module 'vue-router'; 以上两个它建议的解决方法我都试过了,没用,然后也问了ai,按照ai给我的方法也无法解决,我的vue3版本对应的vue-router版本是4.x.x,版本是没问题的。
1回答
-
甲蛙
1天前
应该是vue-router安装的版本不对,有可能太新了,你找到我源码,看是哪个版本,就安装哪个版本
00
相似问题