react-native: “xcodebuild” command but it exited with error code 65

After upgrading to React Native 0.59.9 and React 16.8.3 and attempted to run react-native run-ios, I get this error:

info Undefined symbols for architecture x86_64:
  "_JSClassCreate", referenced from:
      facebook::jsc::JSCRuntime::createObject(std::__1::shared_ptr<facebook::jsi::HostObject>)::$_0::operator()() const in libReact.a(JSCRuntime.o)
      facebook::jsc::JSCRuntime::createFunctionFromHostFunction(facebook::jsi::PropNameID const&, unsigned int, std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>)::$_1::operator()() const in libReact.a(JSCRuntime.o)
  "_JSContextGetGlobalObject", referenced from:
      facebook::jsc::JSCRuntime::global() in libReact.a(JSCRuntime.o)
      facebook::jsc::JSCRuntime::createFunctionFromHostFunction(facebook::jsi::PropNameID const&, unsigned int, std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>)::HostFunctionMetadata::initialize(OpaqueJSContext const*, OpaqueJSValue*) in libReact.a(JSCRuntime.o)
  "_JSEvaluateScript", referenced from:
      facebook::jsc::JSCRuntime::evaluateJavaScript(std::__1::unique_ptr<facebook::jsi::Buffer const, std::__1::default_delete<facebook::jsi::Buffer const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libReact.a(JSCRuntime.o)
  "_JSGlobalContextCreateInGroup", referenced from:
      facebook::jsc::JSCRuntime::JSCRuntime() in libReact.a(JSCRuntime.o)
      facebook::jsc::JSCRuntime::JSCRuntime() in libReact.a(JSCRuntime.o)
  "_JSGlobalContextRelease", referenced from:
      facebook::jsc::JSCRuntime::JSCRuntime() in libReact.a(JSCRuntime.o)
      facebook::jsc::JSCRuntime::~JSCRuntime() in libReact.a(JSCRuntime.o)
      facebook::jsc::JSCRuntime::JSCRuntime() in libReact.a(JSCRuntime.o)
  "_JSGlobalContextRetain", referenced from:
      facebook::jsc::JSCRuntime::JSCRuntime(OpaqueJSContext*) in libReact.a(JSCRuntime.o)
  "_JSObjectCallAsConstructor", referenced from:
      facebook::jsc::JSCRuntime::callAsConstructor(facebook::jsi::Function const&, facebook::jsi::Value const*, unsigned long) in libReact.a(JSCRuntime.o)
  "_JSObjectCallAsFunction", referenced from:
      facebook::jsc::JSCRuntime::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) in libReact.a(JSCRuntime.o)
  "_JSObjectCopyPropertyNames", referenced from:
      facebook::jsc::JSCRuntime::getPropertyNames(facebook::jsi::Object const&) in libReact.a(JSCRuntime.o)

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening NFIBEngage.xcworkspace

** BUILD FAILED **


The following commands produced analyzer issues:
	Analyze /Users/danale/Projects/engage-application.mobile/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal x86_64
	Analyze Base/RCTModuleMethod.mm normal x86_64
(2 commands with analyzer issues)

React Native version:

info
  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 161.54 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 11.10.1 - /usr/local/bin/node
      Yarn: 1.10.1 - /usr/local/bin/yarn
      npm: 6.7.0 - /usr/local/bin/npm
      Watchman: 4.7.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 26.0.2, 27.0.3, 28.0.3
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.9 => 0.59.9
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Steps To Reproduce

  1. Run react-native run-ios

Describe what you expected to happen:

Well, since I did upgrade I had expected some bugs, but I am unfamiliar with the inner workings of Xcode in conjunction with React Native.

Snack, code example, or link to a repository:

https://www.dropbox.com/s/ygyrhnno8aou4jg/RNsampleApp.zip?dl=0

I was eventually able to resolve the above error by following this guide:

https://stackoverflow.com/questions/54515175/undefined-symbols-for-architecture-arm64-jsclasscreate

and running react-native link.

However, now inside of Metro Bundler I get this error:

VM16:1 GET http://localhost:8081/Users/danale/Library/Developer/CoreSimulator/Devices/9E045643-4D13-41F4-A144-781A6513E884/data/Containers/Bundle/Application/AC51BEE9-3B17-4246-A747-D9D47B460B58/NFIBEngage.app/main.jsbundle 404 (Not Found)
(anonymous) @ VM16:1
deltaUrlToBlobUrl @ deltaUrlToBlobUrl.js:31
getBlobUrl @ (index):209
ws.onmessage @ (index):184
(index):190 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

I am not exactly sure what is going on there, but its referencing a line of code found inside of ios/NFIBEngage.xcodeproj/project.pbxproj:

/* Begin PBXFileReference section */
		008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
13B07FAE1A68108700A75B9A /* NFIBEngage */ = {
			isa = PBXGroup;
			children = (
				6B2F5E9F2007D4B500FF4B14 /* UA.entitlements */,
				6B2F5E9E2007D4AC00FF4B14 /* QA.entitlements */,
				6B2F5E9D2007D49F00FF4B14 /* DEV.entitlements */,
				6B2F5E9C2007D44300FF4B14 /* PROD.entitlements */,
				6BC6C0D81FD1CB6400AD9FC6 /* Configuration */,
				008F07F21AC5B25A0029DE68 /* main.jsbundle */,

When I attempt a react-native run-ios a second time, I still get a successful build in Xcode but with this error:

info ** BUILD SUCCEEDED **


info Installing build/NFIBEngage/Build/Products/Debug-iphonesimulator/NFIBEngage.app
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=164):
Unable to lookup in current state: Shutdown
Print: Entry, ":CFBundleIdentifier", Does Not Exist
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/NFIBEngage/Build/Products/Debug-iphonesimulator/NFIBEngage.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

and when I attempt to open the app in the Simulator, it does not boot up and in debugger-ui I get this error:

VM16:1 GET http://localhost:8081/Users/danale/Library/Developer/CoreSimulator/Devices/9E045643-4D13-41F4-A144-781A6513E884/data/Containers/Bundle/Application/AC51BEE9-3B17-4246-A747-D9D47B460B58/NFIBEngage.app/main.jsbundle 404 (Not Found)
(anonymous) @ VM16:1
deltaUrlToBlobUrl @ deltaUrlToBlobUrl.js:31
getBlobUrl @ (index):209
ws.onmessage @ (index):184
(index):190 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
async function (async)
ws.onmessage @ (index):184
18(index):115 WebSocket connection to 'ws://localhost:8081/debugger-proxy?role=debugger&name=Chrome' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

It gets to the splash screen with the above error and immediately crashes. I then tried adding this script:

"build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/NFIBEngage/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'", but instead of fixing the issue I got this error:

npm run build:ios

> NFIBEngage@1.0.7 build:ios /Users/danale/Projects/engage-application.mobile
> react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/NFIBEngage/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'

Loading dependency graph, done.
transform[stderr]: Trace: The node type SpreadProperty has been renamed to SpreadElement
transform[stderr]:     at Object.isSpreadProperty (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/types/lib/validators/generated/index.js:4304:11)
transform[stderr]:     at hasSpread (/Users/danale/Projects/engage-application.mobile/node_modules/babel-plugin-transform-object-rest-spread/lib/index.js:38:13)
transform[stderr]:     at PluginPass.ObjectExpression (/Users/danale/Projects/engage-application.mobile/node_modules/babel-plugin-transform-object-rest-spread/lib/index.js:234:14)
transform[stderr]:     at newFn (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/visitors.js:193:21)
transform[stderr]:     at NodePath._call (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/path/context.js:53:20)
transform[stderr]:     at NodePath.call (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/path/context.js:40:17)
transform[stderr]:     at NodePath.visit (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/path/context.js:88:12)
transform[stderr]:     at TraversalContext.visitQueue (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/context.js:118:16)
transform[stderr]:     at TraversalContext.visitSingle (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/context.js:90:19)
transform[stderr]:     at TraversalContext.visit (/Users/danale/Projects/engage-application.mobile/node_modules/@babel/traverse/lib/context.js:146:19)
error node_modules/react-native-keyboard-manager/index.js: Cannot read property 'bindings' of null. Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! NFIBEngage@1.0.7 build:ios: `react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/NFIBEngage/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the NFIBEngage@1.0.7 build:ios script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/danale/.npm/_logs/2019-06-13T17_58_48_335Z-debug.log

Then I tried booting up the application via Xcode and it boots up the simulator and attempts to open the application inside of simulator but it hangs on splash screen and Xcode gave me this error:

error: EOF while parsing a value at line 1 column 0

Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.

and it also indicates this configuration inside of Xcode:

/**
 * SplashScreen
 * 启动屏
 * from:http://www.devio.org
 * Author:CrazyCodeBoy
 * GitHub:https://github.com/crazycodeboy
 * Email:crazycodeboy@gmail.com
 */

#import "SplashScreen.h"
#import <React/RCTBridge.h>

static bool waiting = true;
static bool addedJsLoadErrorObserver = false;

@implementation SplashScreen
- (dispatch_queue_t)methodQueue{
    return dispatch_get_main_queue();
}
RCT_EXPORT_MODULE()

+ (void)show {
    if (!addedJsLoadErrorObserver) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jsLoadError:) name:RCTJavaScriptDidFailToLoadNotification object:nil];
        addedJsLoadErrorObserver = true;
    }

    while (waiting) {
        NSDate* later = [NSDate dateWithTimeIntervalSinceNow:0.1];
        [[NSRunLoop mainRunLoop] runUntilDate:later]; Thread 1: signal SIGBART
    }
}

I am still stuck on this main.jsbundle not being found. Can anyone assist here?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 20
  • Comments: 88 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Hello! I faced this issue with React Native version 0.61.2 and this worked for me. Navigate to the ios folder of the app and run the command pod install Once that is done, go back to the root directory and run react-native run-ios

In your project folder:

cd ios
rm -rf build/
cd ..

Run react-native run-ios again.

i have the same error when i use react-native run-ios , but in Xcode,click the run button ,everything is fine

i had the same issue and restarting my computer worked 🤷‍♂

go inside ios folder in terminal cd ios/ run pod install after run react-native run-ios

Same issue. Any solution so far ?

I was getting this error because I ran react-native link, removing the link react-native unlink react-native-vector-icons and then running react-native run-ios and everything worked fine

To solve this problem, I did something like @Ashutosh8127:

cd ios/
$ rm -rf build/
$ pod install
cd ..
$ npm run ios #or npx react-native run-ios

(English is not my native language. Sorry for bad english.) I got the same error even I tried the way in the comments above. But when I reinstalled Cocoapods, I solved the problem! Try it.

cd ios;
rm -rf Pods;
rm -rf build; # may need sudo

sudo gem uninstall cocoapods;
sudo gem install cocoapods;

pod install;
cd ..;

I resolved my issue changing the Build Active Architecture Only to:

Debug >> Yes Release >> No

On xCode, select your Project Target >> Build Settings >> Architetures >> Build Active Architecture Only.

After changing that, react-native run-ios was executed like a charm.

Same problem here.

With xcode, app runs. With react-native run-ios, don’t.

Try changing the Build System property from New Build System (Default) to Legacy Build System. You can do it from here File -> Workspace Settings. That change did the job for me, hope it helps you!

Damn these answers are more confusing

I share with you the solution that has worked for me…

It seems that the behavior of a project in iOS is very similar to a project in JavaScript. Sometimes you have to delete the node_modules folder and reinstall the dependencies.

Follow the next steps:

Close Metro in the terminal and the app in the iOS simulator (remove the app from the simulator if necessary)

cd ios
rm -rf Pods
rm -rf Podfile.lock
pod install

You can finally rebuild the project:

npx react-native run-ios

Good luck and I hope it helps 🚀

Make sure you open your /ios on xcode and go to workspace settings and set the build system to legacy

Hey guys, Same error.

I fixed just by changing the name from “AwesomeProject” to “awesomeproject”

Works for me 😉

We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, is a “generic” error.

In each particular case you have to check messages returned after it, and instead of trying 100+ solutions above, just find a real reason and create a separate issue (if it does not exist already).

Here is a working way:

  1. Just run react-native run-ios, it will compile some swift modules, and fail
  2. Run again react-native run-ios > output.log (now it will have less lines, only related to failure)
  3. Start checking the file thoroughly, the message will not necessarily contain word error, but it would explain something acting not as expected. Checking has to be done from the beginning. Last lines after ** BUILD FAILED ** might not be informative, or may reference not the initial reason of failure.

p.s.: for example in my case it was a problem with PREFIX - conflict between yarn & nvm. reinstalling yarn helped to link it with nvm’s node, and things started to work (https://github.com/nvm-sh/nvm/issues/1645), solution in the end.

But again, in your case it might be something absolutely different, thus so many “solutions” in the topic. Good luck with your search.

Guy , don’t waste your time. This issue may depends on your environnement , I did everything here. But what fixed mine is just to comment use_flipper() line on podfile under iOS dir.

go to an ios folder on the terminal $ cd ios install the pod $ pod install if you don’t have cocoapods installed, run $ brew install cocoapods go back a folder $ cd .. and finally $ react-native run-ios

Thanks for all the solutions everyone! The original issue seems to be a bit dated. Closing, please open a new issue if this occurs in the latest RN version and none of these solutions work.

Hello! I faced this issue with React Native version 0.61.2 and this worked for me. Navigate to the ios folder of the app and run the command pod install Once that is done, go back to the root directory and run react-native run-ios

This helped. I do not know why they are downvoting it.

In your project folder:

cd ios
rm -rf build/
cd ..

Run react-native run-ios again.

It’s worked for me tks

Using a terminal with Rosetta enabled did worked for me 😉

Hello! I faced this issue with React Native version 0.61.2 and this worked for me. Navigate to the ios folder of the app and run the command pod install Once that is done, go back to the root directory and run react-native run-ios

This worked for me

Hello! I faced this issue with React Native version 0.61.2 and this worked for me. Navigate to the ios folder of the app and run the command pod install Once that is done, go back to the root directory and run react-native run-ios

It’s worked for me, thanks!

Hey, I have the same error when I run react-native run-ios after upgrading the react-native version to 0.59.5.

And also Xcode not able to open the project.

Any Help?

I was getting this error because I ran react-native link, removing the link react-native unlink react-native-vector-icons and then running react-native run-ios and everything worked fine

This works for me. Thank’s buddy

Make sure port 8081 is not in use.

lsof -i:8081

Fixed it for me

i had the same issue and restarting my computer worked 🤷‍♂

I tried all the other solutions, but just this one worked. So ridiculous but thanks haha =D

This may occur especially when you change the bundle ID, the provisioning profiles, create new targets etc. So only running pod install may not work. In this cases, we have to also remove the build folder, like @azizuysal said, executing this:

- cd ios
- rm -rf build/

After this everything should get back to normality.

For me, it was just a silly mistake. Don’t contain any space " " in your path. It seems pod would cut the path at " ".

cd ios/ pod install

I was getting this error because I ran react-native link, removing the link react-native unlink react-native-vector-icons and then running react-native run-ios and everything worked fine

The true reason 😄 Even rn-vector-icons installation guide says that linking automatically is not working well. Try other options

@git-sid-go thanx this solution work for me.

Simply adding my dev account to XCode this

Same problem here.

With xcode, app runs. With react-native run-ios, don’t.

Then please try with specific simulator or device. like this

yarn ios --simulator "iPhone 13" or npx react-native run-ios --simulator "iPhone 13"

;P

dont do cd iOS

Just be in your root folder and run npx pod-install

😃

i had the same issue and restarting my computer worked 🤷‍♂

This work for me. Thank you!!!

I just got this error after upgrading to 0.60.4 (from 0.59.2).

To fix it I’ve had to rename the xcworkspace folder from gazella.xcworkspace to Gazella.xcworkspace.

I could successfully run the project from within XCode, but got the error when doing react-native run-ios on the terminal. Now everything works fine.

Using a terminal with Rosetta enabled did worked for me 😉

Praise the lord!

For anyone on macbook m1, this was the only fix that worked

Guys, I tried all the ways with reinstalling pod and node_modules, setting up the Build system and nothing worked. Maybe there are ways to find out the exact cause of this error? Now it doesn’t look informative 😦

Go to ios/Podfile comment out Flipper, then in the console: cd ios, pod install, cd … then start metro server and run your ios project. Should be working now 😃

i had the same issue and restarting my computer worked 🤷‍♂

Hahahah

Hi guys, Same problem…tried with all solutions above mentioned!!

  • rm -rf node_modules
  • rm -rf build
  • yarn
  • npx react-native run-ios

This works for me.

I had this issue and it was because I had renamed my XCode targets to Development and Production (and hence build schemes in XCode) which don’t match my workspace/project name. npx react-native run-ios was looking for a target matching my workspace name, but that no longer existed. I solved this by specifying which scheme to use, which is not a hack or workaround but a reasonable parameter to add if you have multiple schemes:

npx react-native run-ios --scheme "Development"

After a minute of XCode rebuilding my project (through the command line, so you don’t see a ton of progress), I am now up and running.

pod install

I got error code 65 after updating to the latest react-native, the above steps worked.

Facing same error is there any solution for this