Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native init gives Error: Couldn't find preset "es2015"

When I'm trying to start a new react-native project from scratch I'm getting this message.

/Users/jorgevenegas/Dev/Projects/testreact/List/node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:327
          throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
          ^

Error: Couldn't find preset "es2015" relative to directory "/Users/jorgevenegas/Dev/Projects"

I have installed react-native-cli, of course. Using node v4.2.1, react-native 0.1.5, watchman and flow installed too.

Seems to be something related to babel. I can't figure out the reason, though.

I'm attaching a screenshot with a more detailed output.

Error Output

Thanks in the advance!

like image 391
jorgevenegas Avatar asked Mar 04 '16 03:03

jorgevenegas


2 Answers

This bugged me for a good 1 day. The issue was I had a .babelrc file up in my file hierarchy which was interfering with babel parsing. Got rid of that and it was fine. react-native uses es2015 by default so .babelrc is not required.

like image 89
Illuminati Avatar answered Nov 04 '22 21:11

Illuminati


Try installing the following packages

npm install babel-preset-es2015 --save
npm install babel-preset-react --save
like image 30
ThorbenA Avatar answered Nov 04 '22 22:11

ThorbenA