cli: Bundling Android async function run() error
Environment
react-native-cli: 2.0.1 react-native: 0.59.4
Description
I am attempting to bundle the android project using this
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
However I am getting this error
node_modules/@react-native-community/cli/build/cliEntry.js:168
async function run() {
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/_kane7161/
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (6 by maintainers)
@mikeKane here is what I found to solve this …
I just did a fresh install for the first time using the instructions at https://facebook.github.io/react-native/docs/getting-started (including a newly installed Node v10.15.3 via nvm) and I’m seeing this for both iOS and Android but not for
react-native info
:Since
nvm
and paths can be a little crazy I addedconsole.log('Node: ' + process.version);
just before the token error and I seeNode: v10.15.3
on my console. I’m running this from iTerm, where the node version is reported, but the error it presented in a new native Mac Terminal.app window. Suspecting foul play I scrolled up in that new window and saw it running/Users/matt/src/temp/react-native-test/CrossPlatformTest/node_modules/react-native/scripts/launchPackager.command
, which due tonvm
is probably using my default node version (not v10.15.3). I then rannvm alias default v10.15.3
and now it builds./Users/madeeha/Desktop/allergy-app/allergyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:131 let output = [_chalk().default.bold(
react-native ${cmdName} ${argsList}
), this._description ?\n${this._description}\n
: ‘’, …sourceInformation,${_chalk().default.bold('Options:')}
, this.optionHelp().replace(/^/gm, ’ ')]; ^^^SyntaxError: Unexpected token … at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions…js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/Users/madeeha/Desktop/allergy-app/allergyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:5:40) at Module._compile (module.js:409:26) at Object.Module._extensions…js (module.js:416:10) Process terminated. Press <enter> to close the window
Facing same problem with rn version 0.61.1 please help me out to solve this err!!