admin管理员组

文章数量:1332705

I'm new in nuxt js so when I try to add npm packages it won't work these are trials.

star-raing.js

import Vue from 'vue'
import StarsRatings from 'vue-star-rating'
Vue.use(StarsRatings)

nuxt.config.js

    plugins: [{ src: '~/plugins/star-rating.js', mode: 'client' }],
    build: {
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {},
    transpile: ['star-rating']
  }

it shows these errors

[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This 
is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or 
missing <tbody>. Bailing hydration and performing full client-side render.


[Vue warn]: Unknown custom element: <stars-ratings> - did you register the ponent correctly? For         
recursive ponents, make sure to provide the "name" option.

found in

---> <Deals> at ponents/Home/Deals.vue
<Home> at pages/index.vue
<Nuxt>
<Default> at layouts/default.vue
<Root>

I'm new in nuxt js so when I try to add npm packages it won't work these are trials.

star-raing.js

import Vue from 'vue'
import StarsRatings from 'vue-star-rating'
Vue.use(StarsRatings)

nuxt.config.js

    plugins: [{ src: '~/plugins/star-rating.js', mode: 'client' }],
    build: {
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {},
    transpile: ['star-rating']
  }

it shows these errors

[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This 
is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or 
missing <tbody>. Bailing hydration and performing full client-side render.


[Vue warn]: Unknown custom element: <stars-ratings> - did you register the ponent correctly? For         
recursive ponents, make sure to provide the "name" option.

found in

---> <Deals> at ponents/Home/Deals.vue
<Home> at pages/index.vue
<Nuxt>
<Default> at layouts/default.vue
<Root>
Share Improve this question edited Mar 18, 2020 at 11:05 moshfiqrony 4,7433 gold badges23 silver badges32 bronze badges asked Mar 18, 2020 at 8:39 Mohamed ZhranMohamed Zhran 234 bronze badges 3
  • could you show us your home/deals.vue? – Ilijanovic Commented Mar 18, 2020 at 9:00
  • stars-ratings ponent is not registered. ponents: { 'star-rating', VueStarRating.default } – Vigikaran Commented Mar 18, 2020 at 15:50
  • Thanks for help

    本文标签: javascriptcan39t add npm package to nuxt js vuestarratingStack Overflow