Create-react-app: Failed to compile. Missing semicolon semi.

Created on 29 Jun 2018  路  7Comments  路  Source: facebook/create-react-app

Hello,
Working on a project bootstrapped with create-react-app. After I cloned it, I ran npm install and then when I run npm start I get:
Failed to compile
Line 1: Missing semicolon semi
.
.
.
There are a bunch of those in most files on the project. For a split second before this error appears I see the UI of the site, and then the error appears. Has anyone encountered that issue or have an idea where it's coming from? Thanks for the help.

Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.4
Yarn: 1.3.2
npm: 6.1.0
Watchman: Not Found
Xcode: Not Found
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.3.2 => 16.4.1
react-dom: ^16.3.2 => 16.4.1

Most helpful comment

@georgesco94 create-react-app has this feature that blocks UI of the app whenever you have eslint errors (or other). Since you had no eslint configuration you鈥檝e got default lint error on semicolons and once you鈥檝e extended react-app鈥檚 config they disappeared because react-apps config disables lint rule about semi. The error screen will appear again once your code will have lint errors that are enabled in configuration.

EDIT: this feature is called "error overlay"

All 7 comments

Hi,

It could be an error tied to a linter (ESLint maybe?). Do you have a linter in your environment that somehow could explain the error?

I don't believe so. Do you mean if I have a globally installed linter (say ESLint) ? I checked and I don't.

I'd double check the existence of a .eslintrc file in your project or a eslintConfig key in your package.json.

Thanks a lot! There was no .eslintrc file, neither eslintConfig key in package.json. So i added a .eslintrc file at the root level with the following content (I simply saw this from the REACT_README)

{
  "extends": "react-app"
}

Any ideas why that fixed the compilation error, i'm not sure I understand what's going on?

Sorry but I'm not sure either. I actually don't use a linter, only prettier :/

@georgesco94 create-react-app has this feature that blocks UI of the app whenever you have eslint errors (or other). Since you had no eslint configuration you鈥檝e got default lint error on semicolons and once you鈥檝e extended react-app鈥檚 config they disappeared because react-apps config disables lint rule about semi. The error screen will appear again once your code will have lint errors that are enabled in configuration.

EDIT: this feature is called "error overlay"

Seems this was figured out. There was most likely some sort of global eslint config.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jantimon picture jantimon  路  154Comments

sgriffey picture sgriffey  路  113Comments

daviseford picture daviseford  路  108Comments

acskck picture acskck  路  213Comments

akctba picture akctba  路  80Comments