Create-react-app: Compiling error on first 'npm start'

Created on 15 Dec 2017  Â·  5Comments  Â·  Source: facebook/create-react-app

Is this a bug report?

Yes

These 3 steps:

npm install -g create-react-app

create-react-app my-app
cd my-app/
npm start

Resulted in:

Failed to compile.

./src/index.js
Module build failed: Error: Failed to load plugin import: Cannot find module 'eslint-plugin-import'

I have not edited the directories or files at all. Simply followed the first 3 steps in the Getting Started instructions

low (ignored issue template)

All 5 comments

Please follow the issue template.

Those worked for me as :

   >npm install -g react 
   >npm install -g react-dom 

   >npm install -g babel
   >npm install -g  babel-cli

   >npm install -g webpack@latest           --save-dev
   >npm install -g webpack-server-dev    --save-dev

   >npm install -g babel-core
   >npm install -g babel-loader
   >npm install -g babel-preset-react     --save-dev
   >npm install -g babel-preset-es2015  --save-dev

   >npm install -g create-react-app 
   >create-react-app my-app
   >cd my-app
   >npm start  

Install latest version of npm and remove node_moudles folder and lockfile, then re-install packages, the issue can be fixed.
Here's the command for Unix-like OS:

> npm -g update npm
> rm -rf ./node_modules && rm ./package-lock.json
> npm i

I faced the same when the first installation and fixed as followed up just at @latest for every installation done i.e. npm install _LibName_@latest -g --save-dev

The instructions in https://github.com/facebookincubator/create-react-app/issues/3600#issuecomment-353267398 and https://github.com/facebookincubator/create-react-app/issues/3600#issuecomment-353831399 are completely incorrect and will leave your local npm setup in a broken state. Please don’t do it.

You’re not supposed to ever install these projects globally. This might “fix” one problem but will create much larger problems later.

If you have such problems most likely you’re using a buggy npm version. As rightly noted in https://github.com/facebookincubator/create-react-app/issues/3600#issuecomment-353824943, this can usually be solved by updating npm.

If you still experience problems file a new issue and fill out the issue template. Otherwise there’s just no way we can help you because neither of you specified any details (Node, npm versions, what you installed etc) or provided your projects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daviseford picture daviseford  Â·  108Comments

razvan-soare picture razvan-soare  Â·  161Comments

benneq picture benneq  Â·  99Comments

riceyeh picture riceyeh  Â·  116Comments

gaearon picture gaearon  Â·  86Comments