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

React tutorial fails with ESLint error: failed to load babel-eslint parser #127

Open
victorlin opened this issue Jan 5, 2023 · 2 comments · May be fixed by #128
Open

React tutorial fails with ESLint error: failed to load babel-eslint parser #127

victorlin opened this issue Jan 5, 2023 · 2 comments · May be fixed by #128

Comments

@victorlin
Copy link

victorlin commented Jan 5, 2023

I just followed the tutorial, and it failed on Unit 4/5: Create an Azure Static Web App. The failure is visible on the automatically generated workflow run here.

It can also be reproduced locally:

  1. Clone this repo
  2. cd react-app
  3. npm install
  4. npm run build
  5. Observe error:
> [email protected] build
> react-scripts build

Creating an optimized production build...
Failed to compile.

[eslint] Failed to load parser 'react-scripts/node_modules/babel-eslint' declared in '.eslintrc.json': Cannot find module 'react-scripts/node_modules/babel-eslint'
Require stack:
- /Users/victor/repos/victorlin/my-static-web-app/react-app/.eslintrc.json
@sneha774
Copy link

sneha774 commented Feb 6, 2023

2 more issues with react tutorial as of now-
Module not found: Error: Can't resolve 'react-router' in 'C:\Snehal\static-webapp-and-api\static-web-app\react-app\src'
ERROR in ./src/App.js 12:0-42
Module not found: Error: Can't resolve 'react-router' in 'C:\Snehal\static-webapp-and-api\static-web-app\react-app\src'

ERROR in ./src/products/ProductList.js 5:0-42
Module not found: Error: Can't resolve 'react-router' in 'C:\Snehal\static-webapp-and-api\static-web-app\react-app\src\products'

Can be fixed by importing 'withRouter' from 'react-router-dom' instead of 'react-router'

@omgLois
Copy link

omgLois commented Aug 3, 2023

I installed eslint in the root of the application folder (src) by using npm install eslint and then I removed the following from the package.json

"eslintConfig": {
    "extends": "react-app"
  },

then reran npm install followed by npm run build

this has solved the issue for me.

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

Successfully merging a pull request may close this issue.

3 participants