babeljs - react native init: ReferenceError: [BABEL] Unknown option: Unknown option: base.optional -


i'm getting following error upon running react-native init testnative

referenceerror: [babel] /users/m/git/testnative/node_modules/react-native/local-cli/bundle/bundle.js: unknown option: base.optional     @ logger.error (/users/m/git/testnative/node_modules/babel-core/lib/transformation/file/logger.js:41:11)     @ optionmanager.mergeoptions (/users/m/git/testnative/node_modules/babel-core/lib/transformation/file/options/option-manager.js:289:18)     @ optionmanager.init (/users/m/git/testnative/node_modules/babel-core/lib/transformation/file/options/option-manager.js:486:10)     @ file.initoptions (/users/m/git/testnative/node_modules/babel-core/lib/transformation/file/index.js:211:75)     @ new file (/users/m/git/testnative/node_modules/babel-core/lib/transformation/file/index.js:129:22)     @ pipeline.transform (/users/m/git/testnative/node_modules/babel-core/lib/transformation/pipeline.js:48:16)     @ object.transformfilesync (/users/m/git/testnative/node_modules/babel-core/lib/api/node.js:118:10)     @ compile (/users/m/git/testnative/node_modules/babel-register/lib/node.js:100:20)     @ loader (/users/m/git/testnative/node_modules/babel-register/lib/node.js:128:14)     @ object.require.extensions.(anonymous function) [as .js] (/users/m/git/testnative/node_modules/babel-register/lib/node.js:138:7) 

i've tried advice in following posts (https://github.com/facebook/react-native/issues/5, https://github.com/babel/babel-loader/issues/132, https://github.com/babel/babelify/issues/129, react 0.14 error: module build failed: referenceerror: [babel] .../node_modules/eslint-loader/index.js!/.../main.jsx: unknown option: base.stage), no avail.

my current hypothesis because don't have .babelrc file anywhere on system, it's falling "base.optional." @ least adding .babelrc file project folder thing yielded different outcome (downgrading node, babel, or react-native did nothing). so, if solution, know .babelrc file should include react-native project?

thanks

here 1 of .babelrc files can use rn project. note rn works fine no .babelrc file in project (it falls node_modules/react-native/.babelrc file.

{   "retainlines": true,   "compact": true,   "comments": false,   "plugins": [],   "presets": ["stage-0", "react", "react-native"],   "sourcemaps": false, } 

you need add these line package.json file , install dev-dependencies : npm --save-dev <package-name>

"devdependencies": {   "babel-preset-react": "^6.3.13",   "babel-preset-react-native": "^1.4.0",   "babel-preset-stage-0": "^6.3.13" } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -