Open Chitzi opened 8 months ago
Would you be able to provide a reproduction? 🙏
I also have this problem.
d:\Projects\NuxtStarter>npx nuxi init test
√ Which package manager would you like to use? npm o Installing dependencies... 19:07:33
postinstall nuxt prepare
√ Types generated in .nuxt 19:09:22
added 731 packages, and audited 733 packages in 2m
121 packages are looking for funding
run npm fund
for details
found 0 vulnerabilities √ Installation completed. 19:09:22
√ Initialize git repository? No 19:10:09 ✨ Nuxt project has been created with the v3 template. Next steps: › cd test 19:10:09 › Start development server with npm run dev 19:10:09
d:\Projects\NuxtStarter> d:\Projects\NuxtStarter> d:\Projects\NuxtStarter>cd test
d:\Projects\NuxtStarter\test>npx nuxi dev Nuxt 3.10.3 with Nitro 2.8.1 19:10:32 [get-port] Unable to find an available port (tried 3000 on host "localhost"). Using alternative port 3001. 19:10:32 19:10:32 ➜ Local: http://localhost:3001/ ➜ Network: use --host to expose
➜ DevTools: press Shift + Alt + D in the browser (v1.0.8) 19:10:40
WARN Slow module @nuxt/devtools took 5061.65ms to setup. 19:10:40
[19:10:45] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper"
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x2)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x3)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x4)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x5)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x6)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x7)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x8)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x9)
[19:10:46] ERROR Pre-transform error: path should be a path.relative()d string, but got "d:/Projects/NuxtStarter/test/plugin-vue:export-helper" (x10)
i Vite server warmed up in 1592ms 19:10:47 i Vite client warmed up in 1848ms 19:10:47 √ Nitro built in 682 ms nitro 19:10:48
Would you be able to provide a reproduction? 🙏
More info
I've wrote how to reproduce.
npx nuxi@latest init test
# (options npm and yes for github)
cd test
npm run dev
I've tried with an empty project and I've got the error.
I have the same error. I installed on two computers, both: x64, windows 10 pro, 22h2, node v20.11.1., but problem is only on one of them.
Result of http://localhost:3000
500 [vite-node] [plugin:nuxt:components:imports] [VITE_ERROR] plugin-vue:export-helper
export default (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }
at plugin-vue:export-helper
I don;t know if something was updated in the meantime, but i installed it again and now works.
In my case, the problem was solved by running the node as an administrator
Run 'npm run dev' or 'yarn dev' from terminal in your IDE. Not in windows/cmder terminal
same problem here if I am using Cmder.
If you set devtools to false, it will remove the error...
export default defineNuxtConfig({
devtools: { enabled: false }
});
In my case error 500 is returned if devtools is active
500
[vite-node] [plugin:nuxt:components:imports] [VITE_ERROR] /@fs/C:/Users/user/AppData/Roaming/npm/node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.server.mjs
import { defineNuxtPlugin } from "#app";
import { useState } from "#imports";
export default defineNuxtPlugin(() => {
const state = useState("__nuxt_devtools__", () => ({}));
state.value = {
timeSsrStart: Date.now()
};
});
If you set devtools to false, it will remove the error...
export default defineNuxtConfig({ devtools: { enabled: false } });
Unfortunately, it does not work for me. but Thanks anyway.
Also experincing the same issues while i was trying to quickly use a basic templete
Today problem came back again trying with an empty project.
I found that it happens when "npm run dev" is run from windows cmd terminal. Running from windows powershell works ok.
500 [vite-node] [plugin:nuxt:components:imports] [VITE_ERROR] /@fs/C:/Users/user/AppData/Roaming/npm/node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.server.mjs import { defineNuxtPlugin } from "#app"; import { useState } from "#imports"; export default defineNuxtPlugin(() => { const state = useState("__nuxt_devtools__", () => ({})); state.value = { timeSsrStart: Date.now() }; });
If you set devtools to false, it will remove the error...
export default defineNuxtConfig({ devtools: { enabled: false } });
In my case error 500 is returned if devtools is active
500 [vite-node] [plugin:nuxt:components:imports] [VITE_ERROR] /@fs/C:/Users/user/AppData/Roaming/npm/node_modules/@nuxt/devtools/dist/runtime/plugins/devtools.server.mjs import { defineNuxtPlugin } from "#app"; import { useState } from "#imports"; export default defineNuxtPlugin(() => { const state = useState("__nuxt_devtools__", () => ({})); state.value = { timeSsrStart: Date.now() }; });
- Operating System: Windows_NT
- Node Version: v18.17.0
- Nuxt Version: 3.10.3
- CLI Version: 3.10.1
- Nitro Version: 2.9.1
- Package Manager: npm@10.3.0
- Builder: -
- User Config: devtools
- Runtime Modules: -
- Build Modules: -
Same error here
It seems that if the devtools are on C: and the Project is on D: the error occurs.
After some testing I found out that path.relative("D:/some/path", "C:/some/path")
just returns C:/some/path
.
The function gets used here: https://github.com/nuxt/nuxt/blob/a3b0b112245a96c0d3e9485ce6c0c74bbf89c497/packages/kit/src/ignore.ts#L24-L28
which causes an exception with in the ignores package nuxt._ignore.ignores(relativePath)
I am not sure why the nuxt devtools need something from C: C:/Users/user/AppData/Roaming/npm/node_modules/@nuxt/devtools/
I removed the folder and tried to install the dev-tools again, which completely fails now 😅
In my case
Check Task Manager There are some programs running under "Terminal"
If "npm run dev" is called from cmd.exe it will not produce error.
Solution: Change Terminal setting (Ctrl+,) - Startup - Default terminal application - Let Windows Decide or Windows Console Host
Don't use Windows Terminal
In my case
Check Task Manager There are some programs running under "Terminal"
1. OpenConsole.exe 2. cmd.exe 3. WindowsTerminal.exe
If "npm run dev" is called from cmd.exe it will not produce error.
Solution: Change Terminal setting (Ctrl+,) - Startup - Default terminal application - Let Windows Decide or Windows Console Host
Don't use Windows Terminal
You're my day saver :)
None of the solution above worked for me within vscode addon. If i run it manually i get no error, but if i click the vscodee ionic plugin to run it, i get the error. I tried both powersheel and cmd settings in vscode.
Found the culprit
Use Capital for drive letter "C:\" "D:\" If you use "c:\" or "d:\" it won't work
Found the culprit
Use Capital for drive letter "C:" "D:" If you use "c:" or "d:" it won't work
Confirmed the same test result will work by changing drive letter "d:" to capital "D:" .
Any solution for people using Cmder? Is there a way to use Powershell automatically when the command is npm run
or bun run
to make sure there's no issue?
Or even better, is it possible to fix the issue so it still works with Cmder/cmd mode?
Add devtool in your module
modules: [
'@nuxt/devtools',
],
ie
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
'@nuxt/devtools',
],
})
Add devtool in your module
modules: [ '@nuxt/devtools', ],
ie
// https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ devtools: { enabled: true }, modules: [ '@nuxt/devtools', ], })
This is working, thank you!
This is probably caused by a global install of @nuxt/devtools
on a different drive than your project.
It probably highlights an upstream issue somewhere we can resolve.
Environment
Reproduction
npx nuxi@latest init test
(options npm and yes for github)
cd test npm run dev
Describe the bug
500 [vite-node] [plugin:nuxt:components:imports] [VITE_ERROR] plugin-vue:export-helper
export default (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }
at plugin-vue:export-helper
Additional context
No response
Logs