Answer the question
In order to leave comments, you need to log in
How to solve Cannot GET /solm error?
I am using vue-router.
I assembled the project npm run build
, when I try to follow the link /solm
- I get: Cannot GET /solm
.. with other routes / links the same
Router code:
import Vue from 'vue'
import VueRouter from 'vue-router'
import solm from '../views/solm.vue'
import vega from '../views/vega.vue'
import family from '../views/family.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/solm',
name: 'solm',
component: solm
},
{
path: '/vega',
name: 'vega',
component: vega
},
{
path: '/family',
name: 'family',
component: family
},
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
Answer the question
In order to leave comments, you need to log in
Wangyu your server is not configured for the type of routing history
. Google how to set up your server for SPA (all non-API paths should be wrapped in index.html). Well, or switch the router to mode hash
.
In any unclear situation, ALWAYS read the documentation first.
Especially one as good as that of the view.
Here is this section, before enlightenment: https://router.vuejs.org/en/guide/essentials/histo...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question