Create-react-app: Unable to start new app

Created on 14 Feb 2017  ·  11Comments  ·  Source: facebook/create-react-app

Note from Maintainers

Newly created applications experienced a brief disruption between 8:15 PM - 9:15 PM (EST). The issue is now resolved.

Please delete the node_modules directory and then run npm install.
If using yarn, you only need to run yarn upgrade.


Can you reproduce the problem with latest npm?

Yes

Description

I created a new app with create-react-app and I'm not able to run it. I can create a production build just fine and run that, but the development build doesn't work.

Actual behavior

Here is the error I'm receiving in the terminal / browser:

Failed to compile.

Error in ./src/index.js
Module build failed: TypeError: /home/connor/git/Wakonda/src/index.js: Cannot read property 'scope' of undefined
 @ multi main

And here's what I see when I open the console:

Uncaught Error: Cannot find module "/home/connor/git/cra-bug/src/index.js"
    at webpackMissingModule (bootstrap 2a26695…:578)
    at Object.<anonymous> (bootstrap 2a26695…:578)
    at __webpack_require__ (bootstrap 2a26695…:555)
    at bootstrap 2a26695…:578
    at bootstrap 2a26695…:578

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):
    └── [email protected]
  2. node -v:
    v7.5.0
  3. npm -v:
    4.1.2

If it makes any difference, I was using Yarn, but I also tested installing dependencies via npm and got the same issue.

Edit: I also tried this in Windows 10, and I receive the same error.

Then, specify:

  1. Operating system: Elementary OS (Linux)
  2. Browser and version: Chrome 56

Reproducible Demo

https://github.com/Conrad2134/cra-bug

Most helpful comment

I had the same error too.
Just update babel in your project using this command:

npm install --save-dev babel-core

References:

ModuleBuildError: Module build failed: TypeError: Cannot read property 'scope' of undefined
Fix bug - undefined reference for export declaration

All 11 comments

I'm getting the same error.

Environment:
node v7.2.1
OSX El Capitan 10.11.5

I think it has to do with the version of babel-core used.

I fixed it by:

  1. Ejecting
  2. Upgrading babel-core to 6.23.0

I'm getting the same error

Environment:
node -v
v7.4.0

npm -v
4.2.0

Operating System: macOS Sierra v10.12.3

I had the same error too.
Just update babel in your project using this command:

npm install --save-dev babel-core

References:

ModuleBuildError: Module build failed: TypeError: Cannot read property 'scope' of undefined
Fix bug - undefined reference for export declaration

@ajeremias - that _did_ work for me, thanks for the tip! 👍

If anyone needs a temporary solution - that's it.

This is broken for me as well.

Error in ./src/index.js
Module build failed: TypeError: /Users/**/Documents/node/projects/hello-world/src/index.js: Cannot read property 'scope' of undefined
@ multi main

@ajeremias - that worked for me, too! Didn't need to eject.

We inadvertently released a backwards incompatible change in babel-traverse.

We just reverted it and released a fix (6.23.1) that should fix this issue. Please reinstall deps. Sorry for the inconvenience!

Sorry for the trouble everyone! Perhaps now is the time to reignite our Yarn discussions.

Thanks for looking into it!

I've opened an issue about this here so we can try to prevent this from happening in the future: https://github.com/facebookincubator/create-react-app/issues/1551

Was this page helpful?
0 / 5 - 0 ratings