prettier-eslint: Cannot find module './utils/ast-utils'

Versions:

  • prettier-eslint version: 9.0.0
  • node version: 10.17.0
  • npm (or yarn) version: yarn 1.19.1

Have you followed the debugging tips?

Yes

Relevant code or config

https://gist.github.com/selfagency/d09dddd361376e47d515a0f1483b03de

What I did:

I use prettier-eslint via Vetur in VS Code and it’s been working just fine up until today, when it started throwing the following error.

What happened:

[INFO - 8:33:35 AM] Loaded module 'prettier-eslint@undefined' from '/Users/daniel/code/ironmarch/web/node_modules/prettier-eslint/dist/index.js'.
[ERROR - 8:33:35 AM] Error
Cannot find module './utils/ast-utils'
Require stack:
- /Users/daniel/code/ironmarch/web/node_modules/eslint/lib/rules/arrow-spacing.js
- /Users/daniel/code/ironmarch/web/node_modules/eslint/lib/built-in-rules-index.js
- /Users/daniel/code/ironmarch/web/node_modules/eslint/lib/rules.js
- /Users/daniel/code/ironmarch/web/node_modules/eslint/lib/linter.js
- /Users/daniel/code/ironmarch/web/node_modules/eslint/lib/api.js
- /Users/daniel/code/ironmarch/web/node_modules/prettier-eslint/dist/utils.js
- /Users/daniel/code/ironmarch/web/node_modules/prettier-eslint/dist/index.js
- /Users/daniel/.vscode/extensions/esbenp.prettier-vscode-3.6.0/dist/extension.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js

Problem description:

Cannot find module ‘./utils/ast-utils’

Suggested solution:

¯\_(ツ)_/¯

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I got the same issue, but i think mostly because the newest version of eslint.

Error: Cannot find module 'eslint/lib/rules/utils/ast-utils'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/xieww/Desktop/CRN/FlightCharterPlane/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js:24:21)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

This didn’t fix my issue 😦 https://www.stephencharlesweiss.com/2019-10-14/eslint-prettier-vscode/

However, the following steps did seem to rectify the issue:

  1. rm -rf ./node_modules && yarn
  2. Add "prettier-eslint.eslintIntegration": true, to VSCode Settings file (ignore Unknown configuration setting warning)
  3. Reload VSCode window (⌘ R)
  4. Remove "prettier-eslint.eslintIntegration": true, that was just put in
  5. Try saving a file

¯\_(ツ)_/¯

@victoriatomzik just started getting this error too. Maybe this is something new? Like, package become broken

I believe @victoriatomzik’s issue was related to typescript-eslint not supporting ESLint 5. https://github.com/typescript-eslint/typescript-eslint/pull/2917 was recently merged which fixes this.

This PR is available on NPM at/above 4.12.1-alpha.1