Failed to load parser './parser.js' declared in .eslintrc.json
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
next info
output
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:25 PDT 2022; root:xnu-8020.140.41~1/RELEASE_X86_64
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: 3.2.2
pnpm: N/A
Relevant packages:
next: 12.2.3-canary.17
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
package.json
{
"name": "web",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"info": "next info"
},
"dependencies": {
"next": "canary",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "8.20.0",
"eslint-config-next": "12.2.3"
}
}
What browser are you using? (if relevant)
NA
How are you deploying your application? (if relevant)
NA
Describe the Bug
next dev
is working fine, but next lint
is failing with the following error.
info - SWC minify release candidate enabled. https://nextjs.link/swcmin
Failed to load parser './parser.js' declared in '.eslintrc.json » eslint-config-next/core-web-vitals » /Users/sumit.goel/Development/monorepo/.yarn/__virtual__/eslint-config-next-virtual-c1b113f562/0/cache/eslint-config-next-npm-12.2.3-8aa11ec9cd-bba70ac318.zip/node_modules/eslint-config-next/index.js': eslint-config-next tried to access next, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: next (via "next/dist/compiled/babel/eslint-parser")
Required by: eslint-config-next@virtual:569035de073023aa8b0b5018956311b227b0a904329a09033178811fc3e35e666a9055672cf1571918d7dc6006c37bb02ee20b7a6a08428927cea962afec4a25#npm:12.2.3 (via /Users/sumit.goel/Development/monorepo/.yarn/__virtual__/eslint-config-next-virtual-c1b113f562/0/cache/eslint-config-next-npm-12.2.3-8aa11ec9cd-bba70ac318.zip/node_modules/eslint-config-next/)
Require stack:
- /Users/sumit.goel/Development/monorepo/.yarn/__virtual__/eslint-config-next-virtual-c1b113f562/0/cache/eslint-config-next-npm-12.2.3-8aa11ec9cd-bba70ac318.zip/node_modules/eslint-config-next/parser.js
- /Users/sumit.goel/Development/monorepo/.yarn/cache/@eslint-eslintrc-npm-1.3.0-1f3c51be25-a1e734ad31.zip/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
Expected Behavior
The next lint
command is successful with no errors.
Link to reproduction
Please check the steps below to reproduce.
To Reproduce
$ mkdir monorepo && cd "$_"
$ yarn init -2 -p -w
$ yarn create next-app packages/web
$ yarn workspace web add next@canary
$ yarn workspace web run lint
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Error: Failed to load parser '@typescript-eslint/parser' declared ...
I am creating an add-to-cart app in vuejs. I am using the typescript language in vuejs but the babel-eslint parser keeps giving me...
Read more >Error: Failed to load parser 'babel-eslint' declared in '.eslintrc ...
To fix this issue just reuse babel-eslint dependency from react-scripts , that already installed. Update your config:
Read more >Failed to load parser '@typescript-eslint/parser' declared in ...
Failed to load parser '@typescript-eslint/parser' declared in .eslintrc.json: Cannot find module json-schema.
Read more >Failed to load parser '@typescript-eslint/parser ... - Reddit
I'm getting this error when running :ALEInfo. Googling the error, all of the advice says to make sure eslint is updated with npm...
Read more >failed to load parser '@angular-eslint/template-parser' - You.com
@jeremybarbet . Are you seeing: Error: Failed to load parser '@babel/eslint-parser' declared in '.eslintrc.js': Cannot find module ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much @reck1ess It works.
I had to add
react
andreact-dom
as well to get rid of the warnings.