Auth-module: This dependency was not found

Created on 2 Apr 2021  路  9Comments  路  Source: nuxt-community/auth-module

Version

module: 5.0.0-1616003482.75c20e6
nuxt: 2.15.4

Nuxt configuration

mode:

  • [x] universal
  • [x] spa

Nuxt configuration

yarn add --exact @nuxtjs/auth-next and nuxt config add, yarn dev

Screen Shot 2021-04-02 at 08 02 48

  • [x] I have tested with the latest Nuxt version and the issue still occurs
  • [x] I have tested with the latest module version and the issue still occurs

    WARN in ./node_modules/hasha/index.js

Module not found: Error: Can't resolve 'worker_threads' in '/a/node_modules/hasha'

This dependency was not found:

  • fs in ./node_modules/@nuxtjs/auth-next/dist/module.js, ./node_modules/hasha/index.js
bug

All 9 comments

axios.ts change algoritma and fixed. Interesting :D

Did you find Solving?

Having the same issue.

Same issue here too. I want at least a workaround.

I tried to add a custom scheme. As long as the new file is empty, it does not show an error, but once I imported LocalScheme from '@nuxtjs/auth-next', it shows an error. Any idea how to resolve it? @productfrontenddeveloper

Hi @TonalidadeHidrica! Can you open a new issue with more info about this issue you're facing, your auth config and some reproduction steps? Also, if you could make a repro in CodeSandbox using this template would be awesome, it would help me a lot! Thank you in advance :)

@JoaoPedroAS51 Thank you for your offer! After struggling for hours I found out the actual cause, which I will describe below.

I was trying to define a custom scheme extending LocalScheme. In schemes/myCustomScheme.ts I wrote the following import statement:

import { LocalScheme } from '@nuxtjs/auth-next'

export default class MyCustomScheme extends LocalScheme {
  // ...
}

This caused the following error message to be output in the nuxt dev console:

WARN in ./node_modules/hasha/index.js
Module not found: Error: Can't resolve 'worker_threads' in '/a/node_modules/hasha'

This dependency was not found:
- fs in ./node_modules/@nuxtjs/auth-next/dist/module.js, ./node_modules/hasha/index.js

The culprit was the import statement. As written in official docs, and pointed out clearly in this issue comment (which definitely saved my day, thanks!), I MUST have import from ~auth/runtime instead:

import { LocalScheme } from '~auth/runtime'

Once I replaced the import statement, everything started to work fine. So in my case, that was the reason.

Again, thank you for helping me out! @JoaoPedroAS51
For those who are having trouble with this issue, I hope this information would help! @maggi08 @BtheGit

Thanks for sharing the solution here. I'm happy to know it's working now! :)

If nothings works, try to upgrade your @nuxtjs/auth-next.

import {LocalScheme} from '~auth/runtime' is now working for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DiegoGallegos4 picture DiegoGallegos4  路  3Comments

yuwacker picture yuwacker  路  3Comments

amjadkhan896 picture amjadkhan896  路  3Comments

varna picture varna  路  4Comments

ishitatsuyuki picture ishitatsuyuki  路  4Comments