0

I am currently integrating the nuxt auth module into my application and when I run

npm run dev

I am facing a fatal error

Cannot resolve "user" from "C:\ ...\user"

at Resolver.resolvePath (node_modules@nuxt\core\dist\core.js:347:11)

at resolveScheme (node_modules@nuxtjs\auth-next\dist\module.js:485:21)

at resolveStrategies (node_modules@nuxtjs\auth-next\dist\module.js:464:26)

at ModuleContainer.authModule (node_modules@nuxtjs\auth-next\dist\module.js:515:42)

at ModuleContainer.addModule (node_modules@nuxt\core\dist\core.js:239:34)

at node_modules@nuxt\utils\dist\utils.js:639:43

at async ModuleContainer.ready (node_modules@nuxt\core\dist\core.js:55:5)

at async Nuxt._init (node_modules@nuxt\core\dist\core.js:478:5)

Here are all the seetings I am using:

auth configuration in nuxt.config.js

  auth: {
    strategies: {
      local: {
        token: {
          property: 'token',
          global: true,
          type: 'Bearer'
        },
        user: {
          property: 'user',
          autoFetch: true
        },
        endpoints: {
          login: { url: '/token/login', method: 'post' },
          user: { url: '/user/', method: 'get' }
        }
      }
    }
  },

package.json

{
  "name": "<MY_APP_NAME>",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
    "lint": "yarn lint:js"
  },
  "dependencies": {
    "@nuxtjs/auth-next": "^5.0.0-1648802546.c9880dc",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/pwa": "^3.3.5",
    "core-js": "^3.15.1",
    "crypto-js": "^4.1.1",
    "cryptojs": "^2.5.3",
    "lodash": "^4.17.21",
    "nuxt": "^2.15.7",
    "nuxt-storage": "^1.2.2",
    "vuetify": "^2.5.5"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.14.7",
    "@nuxtjs/eslint-config": "^6.0.1",
    "@nuxtjs/eslint-module": "^3.0.2",
    "@nuxtjs/vuetify": "^1.12.1",
    "eslint": "^7.29.0",
    "eslint-plugin-nuxt": "^2.0.0",
    "eslint-plugin-vue": "^7.12.1"
  }
}

Additional information: I have already tried a few things and noticed that the error arises as soon as I add the @nuxtjs/auth-next package to the modules array inside the nuxt.config.js file.

Please let me know if you need any additional information to get a better understanding of my problem.

Update

I got it running using the old @nuxtjs/auth module. Nevertheless I would like to use the up to date package. Therefor I would still appreciate any help.

  • The v5 should be compatible with Nuxt2 as shown here: https://auth.nuxtjs.org/status/ Strange. Maybe try another version: remove and install it back. – kissu Sep 25 '22 at 05:07

1 Answers1

0

I already got it working. I deleted the package.json file and resetup the whole project.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 28 '22 at 04:32