Search code examples
node-modulesnpm-installnuxt3.js

Nuxt 3.3.2 wrong path to node_modules


I have a problem with nuxt, When I use the command npm run dev it throws me this error ERROR Failed to load url /@fs/Users/krzysztofjust/node_modules/hookable/dist/index.mjs?v=d68fa752 (resolved id: /Users/krzysztofjust/node_modules/hookable/dist/index.mjs?v=d68fa752) in /Users/krzysztofjust/node_modules/nuxt/dist/app/nuxt.js. Does the file exist?, I tried to remove node_modules, package-lock.json, and use npm i and still the error occurs.

The project runs on my old computer, currently running on a Macbook Air M1

npm version: 8.19.3

node version: 18.13.0

my package.json

{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "generate-icons": "node assets/generate-icons/generate.js",
    "lintfix": "eslint --fix --ext \".ts,.js,.vue\" --ignore-path .gitignore .",
    "lint:js": "eslint --ext \".ts,.js,.vue\" --ignore-path .gitignore .",
    "lint:style-test": "stylelint **/*.{vue,css,scss} --ignore-path .gitignore",
    "lint:style": "stylelint **/*.{css,scss} --ignore-path .gitignore",
    "lint": "npm run lint:js && npm run lint:style"
  },
  "dependencies": {
    "@nuxtjs/i18n": "8.0.0-beta.9",
    "@nuxtjs/robots": "^3.0.0",
    "@pinia/nuxt": "^0.4.7",
    "fantasticon": "^2.0.0",
    "gardevoir": "^1.0.0",
    "jwt-decode": "^3.1.2",
    "pinia": "^2.0.33",
    "vee-validate": "^4.8.4",
    "vite-svg-loader": "^4.0.0"
  },
  "devDependencies": {
    "@nuxt/content": "^2.5.2",
    "@typescript-eslint/eslint-plugin": "^5.57.0",
    "@typescript-eslint/parser": "^5.57.0",
    "@vue/eslint-config-standard": "^8.0.1",
    "eslint": "^8.37.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-nuxt": "^4.0.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-vue": "^9.10.0",
    "prettier": "^2.8.7",
    "sass": "^1.60.0",
    "sass-loader": "^13.2.2",
    "stylelint": "^15.3.0",
    "stylelint-config-prettier-scss": "^0.0.1",
    "stylelint-config-standard-scss": "^7.0.1",
    "stylelint-prettier": "^3.0.0",
    "typescript": "^5.0.2"
  }
}

Solution

  • The error was caused by my oversight, nuxt was installed globally, making the path to node_modules, took from the home directory, problem solved, I uninstalled nuxt globally and installed only in the project.