-
Description:When i create a new field with I get the following error: this is line 70 in the vue-loader/dist/index.js When i change the vue-loader to version 15.9.4 it compiles without any errors, but then is doesn't show on the resource where i add the field and get the following error in the console: Detailed steps to reproduce the issue on a fresh Nova installation:
I hope i described the error goed enough! Am I doing something wrong? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 21 comments 10 replies
-
Which version of Node? |
Beta Was this translation helpful? Give feedback.
-
Node version: 16.13.0 |
Beta Was this translation helpful? Give feedback.
-
Just tested the reproducing steps and was unable to replicate it with |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! What NPM version are you running? Just tested with NPM and got the same error. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Tested with the following: ➜ node -v
v14.19.2
➜ npm -v
6.14.17 and also ➜ node -v
v16.15.0
➜ npm -v
8.5.5 |
Beta Was this translation helpful? Give feedback.
-
I had the same issue with Yarn. It was a pain and for me it was more convenient to shift back to NPM.
This works for me. |
Beta Was this translation helpful? Give feedback.
-
Hmmm....that's so strange, i run the exact same versions as you. But it keeps failing (also with NPM) (Test is inside the custom fields directory) |
Beta Was this translation helpful? Give feedback.
-
Not sure if it interferes with something but have you deleted Also: What does your |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reaction! I just tested with a clean laravel & nova install, when i created a field it did compile without any errors. I think i'm reinstalling nova in my existing project, maybe that will solve it! Will let you know if this is the case, thanks so far. PS: i tried it with a newly generated field, kept getting the same error.... |
Beta Was this translation helpful? Give feedback.
-
So i've re-installed nova and tried to make a field than compile it. At first i did get the same errors. I found out that if i remove the node_modules folder from the root project (so not the node_modelus from the nova field directory) the field compiles without any errors. As soon as I run Any idea how that's possible? |
Beta Was this translation helpful? Give feedback.
-
Still not possible to replicate this |
Beta Was this translation helpful? Give feedback.
-
I think it's related to that: vuejs/vue-loader#1973 |
Beta Was this translation helpful? Give feedback.
-
Deleted node_modules from the root project allows fields to be compiled. I'm really struggling to understand why this is? Could it be that the nova fields vue-loader is somehow using node_modules rather than vendor/nova/node_modules. Anyway |
Beta Was this translation helpful? Give feedback.
-
Anyone else came across an issue where your Nova field just won't accept the changes in the browser (even though I removed a line from a Vue component (for a Nova field) and tried many things but in the browser it still displays the old version:
|
Beta Was this translation helpful? Give feedback.
-
After some additional research, this is due to This can be solved by adding the following: npm uninstall "@vue/compiler-sfc"
npm install -D "vue" Example: nova-issues/issue-4595@e56d8af There could be side-effect on requiring |
Beta Was this translation helpful? Give feedback.
-
Yaaaay... I just found this... I just created the exact same issue lol.. #4813... so.. I guess that should be deleted right? I'm excited to read through and find the solution to my problem! |
Beta Was this translation helpful? Give feedback.
-
The accepted answer didn't work for me - not sure why. My setup is such that I have a Laravel project using Vue 2 and want to add a Nova 4 tool, which tries to use elements of Vue 3 (in vue-loader 16 and @vue/compiler-sfc 3). What did work is the following ugly hack. In
What this does is edit the file
It adds a |
Beta Was this translation helpful? Give feedback.
-
Weird stuff happening on my side: Back to my work computer, I have a new, different error: ERROR in ./resources/js/field.js + 37 modules
Assigning to rvalue (71:8)
| _this3.allowLeavingForm();
| }, function () {
| Object(function webpackMissingModule() { var e = new Error("Cannot find module '@inertiajs/inertia'")
; e.code = 'MODULE_NOT_FOUND'; throw e; }()) = true;
| event.preventDefault();
| event.returnValue = '';
I have other errors : ERROR in ../../vendor/laravel/nova/resources/js/mixins/PreventsModalAbandonment.js 7:0-48
Module not found: Error: Can't resolve 'vuex' in 'laravel/vendor/laravel/nova/resources/js/mixins'
Did you miss the leading dot in 'resolve.extensions'? Did you mean '[".*",".wasm",".mjs",".js",".jsx",".json","
.vue"]' instead of '["*",".wasm",".mjs",".js",".jsx",".json",".vue"]'?
ERROR in ../../vendor/laravel/nova/resources/js/mixins/packages.js 17:0-49
Module not found: Error: Can't resolve 'form-backend-validation' in ''laravel/vendor/laravel/nova/resources/js/mixins/vendor/laravel/nova/resources/js/mixins'
Did you miss the leading dot in 'resolve.extensions'? Did you mean '[".*",".wasm",".mjs",".js",".jsx",".json","
.vue"]' instead of '["*",".wasm",".mjs",".js",".jsx",".json",".vue"]'?
I also tried @janzankowski 's answer but nothing works. Sigh. Using node 16.15.1 and npm 8.11.0 |
Beta Was this translation helpful? Give feedback.
-
WTF! I looked at the field's Out of curiosity, I applied the accepted answer's fix again, then run I then run |
Beta Was this translation helpful? Give feedback.
-
In case anyone here is still having the same issues & no luck with any of the proposed solutions - I was FINALLY able to get everything running again only after cloning my repo fresh and going through a new install. I don't know if this was a matter of cached files or what, but I tried everything - including wiping the cache, reinstalling dependencies, deleting dist folder/node_modules/etc. Hope this helps someone too! |
Beta Was this translation helpful? Give feedback.
After some additional research, this is due to
vue-loader
trying to userequire('vue/compiler-sfc')
insteads ofrequire('@vue/compiler-sfc')
which is required directly in the template. https://github.com/vuejs/vue-loader/blob/6a293dff5f2ed3167eb3b448f1d714091185a44e/src/compiler.ts#L12-L25This can be solved by adding the following:
Example: nova-issues/issue-4595@e56d8af
There could be side-effect on requiring
vue
directly (the generated dist are slightly larger with more code) but I can't find any error at the moment. Best to first try withnpm run dev
and tests it out before usingnpm run prod
.