Error Messages:
Compiled with problems:X
ERROR in ./src/router/index.js 2:0-23
Module not found: Error: Can’t resolve ‘vue ‘ in ‘D:\F\XX\project-SPH\app\src\router’ERROR in ./src/router/index.js 3:0-36
Module not found: Error: Can’t resolve ‘vue-router ‘ in ‘D:\F\XX\project-SPH\app\src\router’ERROR in ./src/router/index.js 8:0-36
Module not found: Error: [CaseSensitivePathsPlugin] `D:\F\XX\project-SPH\app\src\pages\search\index.vue` does not match the corresponding path on disk `Search`.
The incorrect index.js code at this point is as follows:
// Where to configure routing
import Vue from 'vue ';
import VueRouter from 'vue-router ';//Using the plug-in
Vue.use(VueRouter);
//Introduction of routing components
import Home from '@/pages/Home'
import Search from '@/pages/search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
//configure routing
export default new VueRouter({
//configure routing
routes:[
{
path : "/home",
component:Home
},{
path: " /search",
component:Search
},{
path: " /login",
component:Login
},{
path: " /register",
component:Register
}
]
})
Process
At first, it was because Vue-router could not be installed. I suspected that Vue-router was not installed properly.
After an afternoon of Googling to find the cause, I decided to look at the code myself to see what the error meant. There are a total of 3 code: all point to the index.js file.
The first place: pointing to Search, I looked at the reference Search place, found written in lower case.
The second place: the reference to vue and vue-router, after careful observation, I found that I wrote an extra space.
After correction, it can be run again without any error.
Read More:
- Module not found: Error: Can‘t resolve ‘core-js/modules/es.promise.js‘ in
- [Solved] ERROR in ./src/main.ts Module not found: Error: Can‘t resolve ‘xxx‘
- [Solved] webpack Package Error: ERROR in multi ./src/main.js ./dist/bundle.js Module not found: Error: Can‘t resolv
- Vue-router import Dynamic Module Error [How to Solve]
- [Vue Run Error] Module build failed: Error: Couldn‘t resolve parser “babylon“
- [Solved] Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
- How to open a page in a new window by Vue router
- [Solved] react-router-dom Error: index.js:1 Warning: Functions are not valid as a React child.
- [Solved] Vue Import swiper.css Error: Module not found…
- “Failed to load resource: net::ERR_FILE_NOT_FOUND” error. The project created by vue-cli 3.0 can run under dev, and an error is reported after packaging, and the page is blank.
- [Solved] VS Code Error: Vetur can‘t find ‘tsconfig.json‘ or ‘jsconfig.json‘
- Vue Start Error: This relative module was not found:
- [Solved] Vue-router Error: Navigation cancelled from “/course“ to “/user“ with a new navigation.
- [Solved] Vue Project Error: This relative module was not found
- Can’t resolve ‘ansi-html-community’ & Cannot find module ‘is-docker (vuex-persistedstate Installed)
- [Solved] Router Pinia error: getActivePinia was called with no active Pinia. Did you forget to install pinia
- [Solved] react-router-dom Error: <NavLink>activeClassName
- [Solved] Vue Project Error: Error: Cannot find module ‘webpack‘ Require stack以及Error: Rule can only have one resource so
- [Solved] Vue Route Error: Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_42__.defineComponent) is not a function
- Vue Project Error: Expected indentation of 2 spaces but found 4,Newline required at end of file but not found