question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected token "<" on index.js after npm eject.

See original GitHub issue

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Yes

Which terms did you search for in User Guide?

token, eject, start, server, webpack, <

Environment

  1. node -v: 8.9.1
  2. npm -v: 5.5.1

Then, specify:

  1. Operating system: macOS 10.12.6
  2. Browser and version (if relevant): Firefox Quantum Developer Edition 58

Steps to Reproduce

  1. Eject your create-react-app
  2. Stop any currently running npm starts.
  3. Run npm start.
  4. Cry.

Expected Behavior

I expected the development server to run like normal and serve up my application with no errors, since I hadn’t changed my project at all since ejection.

Actual Behavior

Instead, the development server spat out this error:

image

Reproducible Demo

I was able to reproduce this behaviour by deleting everything from my project except the basic files, index.js and App.js (which I made as basic as possible). You can get it here: https://bitbucket.org/christopherdumas/kairos/branch/eject.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
Timercommented, Nov 23, 2017

@christopherdumas it’s because you have a .babelrc file which doesn’t contain anything required to compile React, ES6+, etc. Delete that file and things should start working.

This commit would’ve caused the break.

Altering your .babelrc to add the react-app preset should also fix it.

0reactions
alexispurslanecommented, Nov 23, 2017

Oh, okay. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token '.' when run create-react-app - Stack Overflow
I am trying to create a new React app using this command on Windows using Node 16.14. npx create- ...
Read more >
How To Fix Unexpected Token Error for NPM Package in react ...
Are you getting this error with react-leaflet or other packages. If you are then it's most likely related to babel and there is...
Read more >
[Solved]-Jest with Create React App: Test suite failed to run
Coding example for the question Jest with Create React App: Test suite failed to run - Unexpected token-Reactjs.
Read more >
eslint-config-react-app - npm
If you want to use this ESLint configuration in a project not built with Create React App, you can install it with the...
Read more >
JavaScript Error Handling: Unexpected Token - GeeksforGeeks
Example 3: An unexpected token ')' occur after i++ which JavaScript cannot recognize.We can remove error here by removing extra ).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found