Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_MODULE_NOT_FOUND on Husky 9.0.10 #1390

Closed
Virakal opened this issue Feb 9, 2024 · 4 comments
Closed

ERR_MODULE_NOT_FOUND on Husky 9.0.10 #1390

Virakal opened this issue Feb 9, 2024 · 4 comments

Comments

@Virakal
Copy link

Virakal commented Feb 9, 2024

After upgrading from 9.0.6 to 9.0.10 I'm getting the following error when running yarn husky:

node:internal/process/esm_loader:40
      internalBinding('errors').triggerUncaughtException(
                                ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/xxx/.yarn/berry/cache/husky-npm-9.0.10-93b6062488-10c0.zip/node_modules/husky/bin.mjs' imported from /home/xxx/Repos/xxx/xxx/
Did you mean to import /home/xxx/.yarn/berry/cache/husky-npm-9.0.10-93b6062488-10c0.zip/node_modules/husky/bin.mjs?
    at new NodeError (node:internal/errors:405:5)
    at finalizeResolution (node:internal/modules/esm/resolve:327:11)
    at moduleResolve (node:internal/modules/esm/resolve:980:10)
    at defaultResolve (node:internal/modules/esm/resolve:1193:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
    at node:internal/modules/run_main:92:28
    at loadESM (node:internal/process/esm_loader:34:13) {
  url: 'file:///home/xxx/.yarn/berry/cache/husky-npm-9.0.10-93b6062488-10c0.zip/node_modules/husky/bin.mjs',
  code: 'ERR_MODULE_NOT_FOUND'
}

I'm using Yarn 4.1.0 on WSL 2, using Zsh. Reverting to 9.0.6 means I can run the setup again. I've tried clearing the Yarn cache but nothing improves. I've tried it on Node 18 and 20.

@Virakal
Copy link
Author

Virakal commented Feb 9, 2024

Just tested - 9.0.8 works for me but 9.0.9 does not.

@typicode
Copy link
Owner

I'm not sure why it's not finding it. Are you trying to import husky/bin.mjs?

@Virakal
Copy link
Author

Virakal commented Feb 15, 2024

I'm just running yarn husky from Zsh. I've tried it with Yarn 1.x and Yarn 4.x with the node_modules linker enabled and it works fine so perhaps this is a Yarn bug rather than something on Husky's side?

@typicode
Copy link
Owner

It seems so. Thanks for the update :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants