Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generated Vue-Cli project: error using VueRouter#7037

AnsweredbyHiws
tom-cosmol asked this question inQ&A
Discussion options

I have this Problem:
The generated vue example as generated with vue create client (vue2)

The original example works,
but when I define even one VueRouter, I get the error
Uncaught TypeError: bootstrap_vue__WEBPACK_IMPORTED_MODULE_2__.default is not a constructor,
see below.
I have tried everything possible and searched everywhere,
although I explicitly use vue 2;
but using the VueRouter remains a problem,

There is no difference if I use the router
_new Vue({
myrouter,
render: h => h(App),
}).$mount('#app')

or not
new Vue({
render: h => h(App),
}).$mount('#app')

vue create client => vue 2

Default ([Vue 2] babel, eslint)

Versions in the generated project as specified onhttps://bootstrap-vue.org/:
npm list:
client@0.1.0 D:\sbox\web\ResourceLockerProject\test3\client
+-- @babel/core@7.18.13
+-- @babel/eslint-parser@7.18.9
+-- @babel/polyfill@7.12.1
+-- @vue/cli-plugin-babel@5.0.8
+-- @vue/cli-plugin-eslint@5.0.8
+-- @vue/cli-plugin-router@5.0.8
+-- @vue/cli-plugin-vuex@5.0.8
+-- @vue/cli-service@5.0.8
+-- bootstrap-vue@2.22.0
+-- bootstrap@4.6.1
+-- core-js@3.24.1
+-- eslint-plugin-vue@8.7.1
+-- eslint@7.32.0
+-- mutationobserver-shim@0.3.7
+-- popper.js@1.16.1
+-- portal-vue@2.1.7
+-- sass-loader@10.3.1
+-- sass@1.54.5
+-- vue-cli-plugin-bootstrap-vue@0.8.2
+-- vue-template-compiler@2.6.12
`-- vue@2.6.12

generated main.js, modified:

import Vue from 'vue'import App from './App.vue'Vue.config.productionTip = false// additional lines to generated example: startimport VueRouter from 'bootstrap-vue'const routes = [  {      path: '/',      component: App  }]const my_router = new VueRouter({   routes });Vue.use(my_router)** // additional lines to generated example: end_new Vue({  render: h => h(App),}).$mount('#app')

Browser => Blank site with error message in the console:

Uncaught TypeError: bootstrap_vue__WEBPACK_IMPORTED_MODULE_2__.default is not a constructor
main.js:14
js app.js:175
webpack_require app.js:257
webpack_exports app.js:1379
O app.js:303
app.js:1380
app.js:1382

You must be logged in to vote
Answered by HiwsAug 27, 2022

This doesn't look quite right

import VueRouter from 'bootstrap-vue'

Replies: 1 comment 1 reply

Comment options

Hiws
Aug 27, 2022
Maintainer

This doesn't look quite right

import VueRouter from 'bootstrap-vue'

You must be logged in to vote
1 reply
@tom-cosmol
Comment options

thank you very much, that's it !
vue add router and: import VueRouter from 'vue-router'

Answer selected byHiws
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@tom-cosmol@Hiws

[8]ページ先頭

©2009-2025 Movatter.jp