Create-react-app: clean new project won't start

Created on 11 Apr 2017  ·  1Comment  ·  Source: facebook/create-react-app

If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.

Can you reproduce the problem with latest npm?

yes

Description

create-react-app demo
cd demo
npm start

will get the following error message:

Failed to compile.

Error in ./src/index.js
Module build failed: Error: Cannot find module 'electron-to-chromium' (While processing preset: "/mnt/c/Users/kunch/github/demo/node_modules/babel-preset-env/lib/index.js") (While processing preset: "/mnt/c/Users/kunch/github/demo/node_modules/babel-preset-react-app/index.js")
 @ multi main

I looked into node_modules/electron-to-chromium and there's no index.js in it, which might be the cause. however i'm curious why a clean setup of create-react-app would run into this problem.

Expected behavior

Expecting "npm start" to start the dev server.

Actual behavior

get the following error message:

Failed to compile.

Error in ./src/index.js
Module build failed: Error: Cannot find module 'electron-to-chromium' (While processing preset: "/mnt/c/Users/kunch/github/demo/node_modules/babel-preset-env/lib/index.js") (While processing preset: "/mnt/c/Users/kunch/github/demo/node_modules/babel-preset-react-app/index.js")
 @ multi main

Environment

kunchenguid@DESKTOP-284F0JO /m/c/U/k/g/demo> npm ls react-scripts
[email protected] /mnt/c/Users/kunch/github/demo
└── [email protected]

kunchenguid@DESKTOP-284F0JO /m/c/U/k/g/demo> node -v
v7.8.0
kunchenguid@DESKTOP-284F0JO /m/c/U/k/g/demo> npm -v
4.4.4
  1. Operating system: Ubuntu on Windows 10 (windows linux subsystems)
  2. Browser and version:

Reproducible Demo

consistently reproducible with clean new project.

create-react-app demo
cd demo
npm start

Most helpful comment

Try running

cd demo
rm -rf node_modules
npm cache clear
npm install

I can’t reproduce this with given Node and npm versions so it’s likely a corrupted cache, a bad local registry, or something like this.

Unfortunately we can’t do anything about npm bugs, but you can try using Yarn instead:

npm i -g yarn

Then next time you run CRA, it will use Yarn and hopefully won’t fail.

>All comments

Try running

cd demo
rm -rf node_modules
npm cache clear
npm install

I can’t reproduce this with given Node and npm versions so it’s likely a corrupted cache, a bad local registry, or something like this.

Unfortunately we can’t do anything about npm bugs, but you can try using Yarn instead:

npm i -g yarn

Then next time you run CRA, it will use Yarn and hopefully won’t fail.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fson picture fson  ·  3Comments

dualcnhq picture dualcnhq  ·  3Comments

onelson picture onelson  ·  3Comments

wereHamster picture wereHamster  ·  3Comments

alleroux picture alleroux  ·  3Comments