react-native init fails with Couldn't find preset "react" relative to directory

Created on 18 Apr 2016  ·  3Comments  ·  Source: facebook/react-native

Running react-native init aborts with error 'Error: Couldn't find preset "react" relative to directory "/Users/agh/dev"'

The detailed error is

react-native init test
This will walk you through creating a new React Native project in /Users/agh/dev/test-react/test
Installing react-native package from npm...
/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:372
          throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
          ^

Error: Couldn't find preset "react" relative to directory "/Users/agh/dev"
    at /Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:372:17
    at Array.map (native)
    at OptionManager.resolvePresets (/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:364:20)
    at OptionManager.mergePresets (/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:348:10)
    at OptionManager.mergeOptions (/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:307:14)
    at OptionManager.addConfig (/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:207:10)
    at OptionManager.findConfigs (/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:413:16)
    at OptionManager.init (/Users/agh/dev/test-react/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:461:12)
    at compile (/Users/agh/dev/test-react/test/node_modules/babel-register/lib/node.js:81:45)
    at loader (/Users/agh/dev/test-react/test/node_modules/babel-register/lib/node.js:126:14)

I have a fresh install of node (5.10.1) and npm (3.8.3) through nvm.

I followed the suggestions listed here, however none of them helped.

The log from react-native init is attached
install.txt

Any help is greatly appreciated :-)

Locked

Most helpful comment

Removing the .babelrc file in the folder solved the problem for me (/Users/agh/dev in your case).

All 3 comments

Removing the .babelrc file in the folder solved the problem for me (/Users/agh/dev in your case).

Yep, that did the trick :-)

Thanks Maurice !

On Fri, Apr 22, 2016 at 3:25 PM, Maurice Svay [email protected]
wrote:

Removing the .babelrc file in the folder solved the problem for me (
/Users/agh/dev in your case).


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/issues/7032#issuecomment-213609470

Was this page helpful?
0 / 5 - 0 ratings