question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot get simple react-native app to work on either Android or iOS

See original GitHub issue
npx-version: 10.2.0

React-native info:

System:
    OS: macOS Mojave 10.14.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 130.27 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
    npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Android Studio: 3.1 AI-173.4720617
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5

Simply initialising a new react-native app and running it (I get the same when I try to run on Android):

npx react-native init Test10
cd Test10
npx react-native run-ios

In the Metro Bundler window, the error log i get is:

/Users/***/test/Test10/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:154
  const cmd = _commander().default.command(command.name).action(async function handleAction(...args) {
                                                                ^^^^^
SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/jonasl/test/Test10/node_modules/react-native/cli.js:13:11)
Process terminated. Press <enter> to close the window

In the simulator I get:

No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start

In the finder window where I ran the commands I get:

info Found Xcode workspace "Test10.xcworkspace"
info Building (using "xcodebuild -workspace Test10.xcworkspace -configuration Debug -scheme Test10 -destination id=96CA3786-25D8-4573-AAD9-50B7F76CB207 -derivedDataPath build/Test10")
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
info Installing "build/Test10/Build/Products/Debug-iphonesimulator/Test10.app"
info Launching "org.reactjs.native.example.Test10"
success Successfully launched the app on the simulator

I appreciate all the help I get 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

7reactions
Kyle-Skicommented, Mar 16, 2020

Commenting in case anyone else runs into this, or similar errors.

I was running into the same syntax error as OP. Found out that every time a new terminal window was opened, nvm was reverting to an older version of node. Using node v13.11.0 solved this problem along with this stack exchange article: https://stackoverflow.com/questions/24585261/nvm-keeps-forgetting-node-in-new-terminal-session Since running react-native run-<YOUR PLATFORM> was opening another terminal window, that new window was where I was still running into the issue.

Basically I had to make sure nvm was initializing a new terminal window with the correct version of node

nvm alias default <NODE VERSION YOU WISH TO USE>
2reactions
JonasLaksencommented, Dec 16, 2019

Solved. I initially used nvm. Used node outside of nvm and it worked. Unfortunately I didn’t write down which version of nvm I used, but I tried with different versions of node within nvm (v10 and v13 something)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrating React Native with existing Android and iOS native ...
The app starts from a native view (by running the native project from Android Studio or Xcode). The native view has an edit...
Read more >
How to Make An App for Android and iOS Using React Native?
1. Installing npm and node. We will install a version manager nvm (setup both node and npm) · 2. Installing java sdk 8...
Read more >
React Native iOS and Android folders not present
Basically, when creating the project with npm, I get some starting files (App.js etc.) and a node_modules folder. I've got it up and...
Read more >
Integration with Existing Apps - React Native
To ensure a smooth experience, create a new folder for your integrated React Native project, then copy your existing Android project to an...
Read more >
How to create React Native App for Android, iOS and Web ...
In this article, we are going to see, how to create a React Native App which can run on Android, iOS and Web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found