laravel-mix: [Vue warn]: Failed to mount component: template or render function not defined. (found in root instance)
When I compiled using laravel mix in one of my old projects I get this error
[Vue warn]: Failed to mount component: template or render function not defined.
(found in root instance
it works fine on Laravel elixir. why do I get this error?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 36
It should be require(‘./components/Example.vue’).default. Since v13, vue-loader exports the component as the default key, which still works the same when using import, but requires the above when using require.
So is the answer changing
to
for all components?
Update:
https://laravel-mix.com/docs/4.0/upgrade
😃
solved it by deleting all of the folders in node_modules that has vue in it and run npm install again.
It Works for me thank you!
Worked for me too! thanks a lot…
Had to update ± 200 vue components to add .default but happy to say it works
thank you worked for me
nice thanks for the insight
On 5/6/19, ricus-zero2one notifications@github.com wrote:
@jericopulvera Reinstalling the node modules (
rm -rf node_modules/ && npm i) didn’t fix it for me. Any clue?@adelynx
Thanks,It works
Thanks. This worked for me
Nice @adelynx it works
fucking perfect answer
worked for me also!
if you are not using larave-mix, outside of laravel. Then I suggest you start here https://vuejs.org/v2/guide/single-file-components.html
your code will most likely look like
Note that vue will use the camel case as hyphen so the component name would be <my-component></my-component> if you need to manually change the name use
components:{ ‘some-name’:MyComponent } <some-name></some-name>
Worked for me too! Thanks …
FWIW in some cases, such as running Vue CLI ui, the package-json.lock file is changed. People then just delete the CLI project, but the lock file still has CLI code which will cause rendering issues like above. I spent half the day troubleshooting this for a customer today. Discovered that they had created a Vue CLI project in their existing app and then deleted the Vue CLI project directory without any changes in CLI ui. So none of the above worked. I only came upon the reference when reading the lock file. I deleted the
package-lock.jsonfile and then rannpm installwhich recreated a new lock file and everything was back to normal.This was the fix I needed, thank you so much.
Super works, you save my day, thanks
Thanks. It worked for me.
Thanks. I’m new to laravel vue. And working on my first project. This seemed a deadline for me, and yet, the solve found. Thanks a lot.