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

Cannot find module eslint-module-utils/visit after updating to v2.25.1 #2255

Closed
slaweet opened this issue Oct 12, 2021 · 23 comments
Closed

Cannot find module eslint-module-utils/visit after updating to v2.25.1 #2255

slaweet opened this issue Oct 12, 2021 · 23 comments

Comments

@slaweet
Copy link

slaweet commented Oct 12, 2021

I had previously eslint-plugin-import@2.24.2. When updating to v2.25.1, I'm getting the following error:


Syntax Error: Thread Loader (Worker 0)
Failed to load plugin 'import' declared in '.eslintrc.json': Cannot find module 'eslint-module-utils/visit'
Require stack:
- /code/node_modules/eslint-plugin-import/lib/ExportMap.js
- /code/node_modules/eslint-plugin-import/lib/rules/named.js
- /code/node_modules/eslint-plugin-import/lib/index.js
- /code/node_modules/@eslint/eslintrc/lib/config-array-factory.js
- /code/node_modules/@eslint/eslintrc/lib/index.js
- /code/node_modules/eslint/lib/cli-engine/cli-engine.js
- /code/node_modules/eslint/lib/cli-engine/index.js
- /code/node_modules/eslint/lib/api.js
- /code/node_modules/eslint-loader/index.js
- /code/node_modules/loader-runner/lib/loadLoader.js
- /code/node_modules/loader-runner/lib/LoaderRunner.js
- /code/node_modules/thread-loader/dist/worker.js
@Haprog
Copy link

Haprog commented Oct 12, 2021

I have the same problem. See details in this PR that only bumps this dependency and causes eslint to fail in the CI build Haprog/hash-actions#47

@smlabt
Copy link

smlabt commented Oct 12, 2021

#2257

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

Oops, forgot to bump the version in 6bdab31.

edit: actually, npm 7+ errored out on npm install --save eslint-module-utils, and i moved too fast to notice that it wasn't updating it.

@JustFly1984
Copy link

JustFly1984 commented Oct 12, 2021

I'm using yarn, adding yarn add -D eslint-module-utils fixing the crashing vscode extension host, but now I'm seeing Cannot read property 'body' of undefined Occurred while linting file.. errors in vscode problem Eslint output.
PS I'm using eslint 7.32.0, cos updating to 8 has issues with eslint-plugin-next, and I guess multiple other plugins, but nextjs is crashing extension host first.

reverting back to 2.24.2 fixes an issue.

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

I would expect anyone who runs npm install --save-dev eslint-plugin-import or yarn add -D eslint-plugin-import to get the latest version of all the subdeps; if this isn't the case, in yarn you can yarn upgrade eslint-module-utils, and i'm sure there's a similar command for npm.

@DamienCassou
Copy link
Contributor

To fix the issue I deleted our yarn.lock and generated a new one.

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

You can also yarn upgrade eslint-module-utils without needing an entirely new lockfile.

@itajaja
Copy link

itajaja commented Oct 12, 2021

yarn upgrade eslint-module-utils won't necessarily work if it's a transitive dependency, I think

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

It absolutely will, especially if it's a transitive dependency - it will update your lockfile without touching package.json in that case.

andrevmatos added a commit to raiden-network/light-client that referenced this issue Oct 12, 2021
andrevmatos added a commit to raiden-network/light-client that referenced this issue Oct 12, 2021
@dylang
Copy link

dylang commented Oct 12, 2021

"eslint-module-utils": "^2.6.2",

https://github.com/import-js/eslint-plugin-import/blob/main/package.json#L106

Should this be updated to "^2.7.0",?

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

Yes, there’s two open PRs already to do that. I’m waiting on something from one of them, and then I’ll cut a patch release.

In the meantime, it’s trivial for anyone to fix this by upgrading eslint-module-utils in their lockfile.

@itajaja
Copy link

itajaja commented Oct 12, 2021

It absolutely will, especially if it's a transitive dependency - it will update your lockfile without touching package.json in that case.

not necessarily the hill I want to die on, but it really doesn't :)

> yarn upgrade eslint-module-utils && yarn why eslint-module-utils
...
...
✨  Done in 8.54s.
yarn why v1.22.0
[1/4] 🤔  Why do we have the module "eslint-module-utils"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "eslint-module-utils@2.6.2"
info Reasons this module exists
   - "eslint-plugin-import" depends on it
   - Hoisted from "eslint-plugin-import#eslint-module-utils"
info Disk size without dependencies: "304KB"
info Disk size with unique dependencies: "512KB"
info Disk size with transitive dependencies: "632KB"
info Number of shared dependencies: 9
✨  Done in 0.65s.

and the (unchanged) yarn entry:

eslint-module-utils@^2.6.2:
  version "2.6.2"
  resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.2.tgz#94e5540dd15fe1522e8ffa3ec8db3b7fa7e7a534"
  integrity sha512-QG8pcgThYOuqxupd06oYTZoNOGaUdTY1PqK+oS6ElF6vs4pBdk/aYxFVQQXzcrAqp9m7cl7lb2ubazX+g16k2Q==
  dependencies:
    debug "^3.2.7"
    pkg-dir "^2.0.0"

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

very weird; that's not my experience. maybe yarn update eslint-module-utils?

@itajaja
Copy link

itajaja commented Oct 12, 2021

update does not exist. I think deleting the yarn.lock file is good hygiene, from time to time, just to avoid some pathological cruft accumulated :)

@nwjsmith
Copy link

I can confirm that yarn upgrade isn't picking up the latest eslint-module-utils, I have exactly the same output as @itajaja. yarn update doesn't appear to be a subcommand.

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

OK, well thanks for correcting me then - yarn upgrade is supposed to work.

I'll stop suggesting it as a workaround.

@smlabt
Copy link

smlabt commented Oct 12, 2021

Yes, there’s two open PRs already to do that. I’m waiting on something from one of them, and then I’ll cut a patch release.

In the meantime, it’s trivial for anyone to fix this by upgrading eslint-module-utils in their lockfile.

I have updated ^2.6.2 to ~2.7.0 in my PR (#2257) , so I think 2.6.2 won't be valid in any lockfile now. I think the problem with ^2.7.0 is, that 2.6.2 is still a valid version.

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

@smlabt i won't land anything not using ^2.7.0; and no, ^2.7.0 is not satisfied by anything less than v2.7.0.

@smlabt
Copy link

smlabt commented Oct 12, 2021

@ljharb Allright then I will close my PR, because I don't know how I can fix this issue :)

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

I REALLY REALLY wish you had not done that; you deleted your fork, which means the PR can never be landed.

I had already force pushed your PR to update the commit; you literally needed to do "nothing" for me to be able to make the release. The fix is now delayed.

@smlabt
Copy link

smlabt commented Oct 12, 2021

@ljharb Sorry, I didn't mean to cause you any trouble. I was not aware that you've made a force-push. Should I open a new PR?

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

No, please don't; I'll figure something out.

@ljharb
Copy link
Member

ljharb commented Oct 12, 2021

v2.25.2 is published.

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

Successfully merging a pull request may close this issue.

9 participants