nuxt: After nuxt installation npm run dev occurs error

Environment

Nuxt project info: 17:59:17


  • Operating System: Windows_NT
  • Node Version: v18.14.2
  • Nuxt Version: 3.3.1
  • Nitro Version: 2.3.1
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-wdaflq-jqcxbf?file=nuxt.config.ts

just follow installation guide on https://nuxt.com/docs/getting-started/installation

and type on terminal npm run dev

Describe the bug

after npm run dev errors on terminal console:

Nuxi 3.3.1 17:56:23
Nuxt 3.3.1 with Nitro 2.3.1 17:56:23 17:56:24

Local: http://localhost:3000/ Network: http://172.27.160.1:3000/ 17:56:23
Network: http://172.31.16.1:3000/ Network: http://192.168.0.125:3000/

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/ofetch/dist/index.mjs?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/ofetch/dist/index.mjs?v=babcfa76) in C:/codes/vscode-workspace/node_modules/nuxt/dist/app/entry.js. Does the file exist?

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/ufo/dist/index.mjs?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/ufo/dist/index.mjs?v=babcfa76) in virtual:nuxt:C:/codes/vscode-workspace/nuxt-test/.nuxt/paths.mjs. Does the file exist?

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/nuxt/dist/head/runtime/plugins/unhead.js?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/nuxt/dist/head/runtime/plugins/unhead.js?v=babcfa76) in virtual:nuxt:C:/codes/vscode-workspace/nuxt-test/.nuxt/plugins/client.mjs. Does the file exist?

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/nuxt/dist/head/runtime/plugins/vueuse-head-polyfill.js?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/nuxt/dist/head/runtime/plugins/vueuse-head-polyfill.js?v=babcfa76) in virtual:nuxt:C:/codes/vscode-workspace/nuxt-test/.nuxt/plugins/client.mjs. Does the file exist?

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/ufo/dist/index.mjs?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/ufo/dist/index.mjs?v=babcfa76) in virtual:nuxt:C:/codes/vscode-workspace/nuxt-test/.nuxt/paths.mjs. Does the file exist?

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/h3/dist/index.mjs?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/h3/dist/index.mjs?v=babcfa76) in C:/codes/vscode-workspace/node_modules/nuxt/dist/app/plugins/router.js. Does the file exist?

                                                                                                                                                                           17:56:25

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/h3/dist/index.mjs?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/h3/dist/index.mjs?v=babcfa76) in C:/codes/vscode-workspace/node_modules/nuxt/dist/app/plugins/router.js. Does the file exist? (x2)

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/ufo/dist/index.mjs?v=babcfa76 (resolved id: C:/codes/vscode-workspace/node_modules/ufo/dist/index.mjs?v=babcfa76) in virtual:nuxt:C:/codes/vscode-workspace/nuxt-test/.nuxt/paths.mjs. Does the file exist?

ERROR Failed to load url /@fs/C:/codes/vscode-workspace/node_modules/@nuxt/ui-templates/dist/templates/welcome.vue (resolved id: C:/codes/vscode-workspace/node_modules/@nuxt/ui-templates/dist/templates/welcome.vue) in C:/codes/vscode-workspace/nuxt-test/app.vue. Does the file exist?

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 21 (5 by maintainers)

Most upvoted comments

I could solve it by setting

nuxt.config.js


  vite: {
    server: {
      fs: {
        strict: false
      }
    }
  }

I could solve it by setting

nuxt.config.js

  vite: {
    server: {
      fs: {
        strict: false
      }
    }
  }

This is also worked for me, on mac m1, linux debian bookworm x86/amd64 and windows running on parallels all of them use the same packages. The weird thing is in my package.json says I have nuxt 3.6.2 and using npx nuxi@latest info it says i have 3.6.0

  • Operating System: Darwin
  • Node Version: v18.16.1
  • Nuxt Version: 3.6.0
  • Nitro Version: 2.5.1
  • Package Manager: pnpm@8.6.7
  • Builder: vite
  • User Config: devtools, app, modules, css, runtimeConfig, routeRules, colorMode, i18n, vite
  • Runtime Modules: @nuxtjs/i18n@8.0.0-beta.12, @nuxtjs/color-mode@3.3.0, @vueuse/nuxt@10.2.1

I cannot reproduce this when following the below steps:

npx nuxi@latest init nuxt-test
cd nuxt-test
yarn
yarn dev

(I’m using yarn here as that is what mentioned as your package manager in the initial issue.)

After upgrading to 3.5.2, the error message changed to say yaml package has problem, could not find the directive.js. delete lock file and node_modules folder, re-run yarn install, same error. I have to copy all files to another folder (excluding lock file and node_modules), and re-run yarn install, everything becomes fine

vite: {
    server: {
      fs: {
        strict: false
      }
    }
  }

2024-04-25_143922

In a previous project, I made a PWA application and the service worker was installed and launched on localhost:3000 After stopping the service worker, everything worked as it should… Thank you!

@songjianet Do you see anything here? I don’t have anything registered right now, so I can’t explain exactly what operation I need to do to delete it.

Screenshot - 2023-10-25 16 36 10

I was also having a very hard time working with the same error message.

But in my case, I had tried the PWA module the day before and it was not working properly, so I gave up using it and deleted the project. I had forgotten that such a thing had happened, but the reason was that the Service Worker at that time was still always waiting at port3000 in the browser and was interfering with the port of the new working project.

I opened Developer Tools and deleted the Service Worker registration and the problem was solved.

Hello guys, I have the same issue with a fresh install of the Nuxt v3.3.1 app:

ERROR  Failed to load url /@fs/node_modules/ofetch/dist/index.mjs?v=fa5b3152 (resolved id: /node_modules/ofetch/dist/index.mjs?v=fa5b3152) in /node_modules/nuxt/dist/app/entry.js. Does the file exist?

And these in the browser console:

Uncaught ReferenceError: __DEFINES__ is not defined
    at env.ts:17:17

Uncaught ReferenceError: process is not defined
    at paths.mjs:10:1