Cannot find module '../ast-utils' when formating
Hi all,
I'm getting the following error after installing prettier-vscode and trying to format a file.
Cannot find module '../ast-utils'
I have no idea about what's happening.
Hi, Same error solved by remplacing the User Settings.json file in vs code. Make it basic like that
{ "terminal.integrated.fontFamily": "Fira mono for Powerline", "window.zoomLevel": 1, "editor.formatOnSave": true }
I just got the same issue
I think it's related to eslint version as I am using this setting "prettier.eslintIntegration": true
and it's what causing the issue and this issue just happened to me after upgrading to eslint version ^5.12.0
The error doesn't provide much context, so I did grep ast-utils -R node_modules/. All the hits were inside eslint, so this is almost certainly an eslint issue. I noticed that my node_modules folder had two copies of eslint, since my project depended on a different version (5.9.0) than prettier-eslint itself (^4.0.0).
Switching my project to depend on the same eslint as prettier-eslint (specifically, ^4.0.0) solved the problem for me.
had the same issue, @swansontec was right, had two eslints in my node_modules
rm -rf node_modules && yarn solved my issues
Is there any resolution for this? Encountering this on eslint 5.16.0
@iRoachie, have you tried rm -rf node_modules and then running npm or yarn again as @mrsufgi suggested?
Looks like I have the same problem. Re-installing node_modules with yarn didn't do it for me. I'm using eslint 6.0.
I am using "prettier.eslintIntegration": false for now and that works. Not sure if I need it.
I think this is down to:
warning " > [email protected]" has incorrect peer dependency "[email protected] - 5.x".
Reverting to eslint 5.16.0 works for now.
@nfantone If I go back to 5.16.x I get errors like:
Failed to load plugin '@typescript-eslint' declared in 'CLIOptions'/myproject/src/index.ts:: Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- /__placeholder__.js
Same problem here with eslint 6.
rm -rf node_modules and npm i did not help.
Error:
Cannot find module '../util/ast-utils'
@CiGit this is urgent now with the new eslint 6 released.
this error happens in windows, in my mac, is fine
https://github.com/benmosher/eslint-plugin-import/pull/1393 is merged and release but still the same problem. This is urgent. I'm crying...
The error doesn't provide much context, so I did
grep ast-utils -R node_modules/. All the hits were inside eslint, so this is almost certainly an eslint issue. I noticed that my node_modules folder had two copies of eslint, since my project depended on a different version (5.9.0) than prettier-eslint itself (^4.0.0).Switching my project to depend on the same eslint as prettier-eslint (specifically, ^4.0.0) solved the problem for me.
Your answer works
My Eslint version is 6.0.1 . It got wrong in vscode .
When I install Eslint 4.0.0 , everything was OK.
@0x80 I honestly wouldn't know. You seem to be working with TS - I'm not. Most probably one of the plugins you're using do require eslint@^6.x Reverting back to latest [email protected] worked for me.
this error happens in windows, in my mac, is fine
@shaodahong Not actually true, I'm afraid. It fails on macOS as well. AFAIK, this is tied to supporting latest eslint. It happens regardless of which OS you are on.
@nfantone sounds bad, hope there fix it
Just ran into this as well so I assume this is about to really hit the fan if not updated soon since I just went through updating eslint across our repos. Luckily google gets here as the top result so it wasn't a time consuming thing to troubleshoot.
Note that with the issue that @0x80 ran into you simply need to reload the VSCode Window (Cmd + Shift + P --> Reload Window)
None of the mentioned solutions do the trick for me.
With [email protected] it couldn't read any plugin, got the error @0x80 mentioned.
With [email protected] it couldn't find ast-utils, got the error @frederikhors