question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Vue warn]: Unknown custom element: <router-link>

See original GitHub issue

Version

3.7.0

Reproduction link

https://github.com/unixc3t/recordstore-front

Environment info

System:
    OS: Linux 4.19 Manjaro Linux
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  Binaries:
    Node: 11.14.0 - ~/.nvm/versions/node/v11.14.0/bin/node
    Yarn: 1.12.3 - ~/.yarn/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v11.14.0/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 66.0.5
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.7.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.7.0 
    @vue/cli-plugin-babel: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-e2e-nightwatch: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-eslint: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-unit-mocha: ^3.7.0 => 3.7.0 
    @vue/cli-service: ^3.7.0 => 3.7.0 
    @vue/cli-shared-utils:  3.7.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/test-utils: ^1.0.0-beta.29 => 1.0.0-beta.29 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^5.0.0 => 5.2.2 
    vue: ^2.6.10 => 2.6.10 
    vue-axios: ^2.1.4 => 2.1.4 
    vue-eslint-parser:  2.0.3 
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-router: ^3.0.3 => 3.0.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.5.21 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vuex: ^3.0.1 => 3.1.1 
  npmGlobalPackages:
    @vue/cli: 3.7.0

Steps to reproduce

git clone git@github.com:unixc3t/recordstore-front.git

find the Signup.spec.js

remove import Vue from ‘vue’ remove Vue.config.ignoredElements = [‘router-link’]

npm run test:unit ./tests/unit/components/Signup.spec.js

What is expected?

I hope to don’t show the next waring:

[Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the “name” option.

What is actually happening?

always show [Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the “name” option.


when I test the signup component

in the component, I use the router-link component

  <div class="my-4">
          <router-link to="/signin" class="link link-gray-900">Sign In</router-link>
        </div>

when I run npm run test:unit ./tests/unit/components/Signup.spec.js always show the warns: [Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the “name” option

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

52reactions
unixc3tcommented, May 16, 2019

@sunlili810 use this

shallowMount(Component, {
  stubs: ['router-link', 'router-view']
})
2reactions
LinusBorgcommented, May 16, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Vue warn]: Unknown custom element: <router-view> - did you ...
unfortunately starting a file gives me an error: [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive ...
Read more >
Unknown custom element: <router-link> — did you register the ...
This is how I solved this error, I just added Vue.use(VueRouter ) in my router. After this another errors below showed up.
Read more >
Laravel Vuejs [Vue warn]: Unknown custom element - Laracasts
Hi everyone! I'm trying to make this crud app with authentication. But i'm experiencing this error: app.js:38573 [Vue warn]: Unknown custom element: -...
Read more >
Router-link - Unknown custom element - Get Help - Vue Forum
[Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the "name" ...
Read more >
Error when running tests in VueJS: Unknown custom element ...
Vue natively doesn't have the <router-link> component. It comes along with the vue-router plugin. In your unit-test code, the vue instance doesn't have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found