facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.18k stars 24.21k forks source link

Latest react-native app doesn't work ":CFBundleIdentifier", Does Not Exist #7308

Closed arun0009 closed 8 years ago

arun0009 commented 8 years ago

On OS X El Capitan v10.11.4

node --version v6.0.0 npm --v 3.8.8 react-native-cli: 0.2.0 react-native: 0.24.1 watchman --v 4.4.0 xcode 7.3

$ react-native init AwesomeProject $ cd AwesomeProject $ react-native run-ios

** BUILD FAILED **

The following build commands failed:
    PhaseScriptExecution Run\ Script /development/misc/react/AwesomeProject/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Script-006B79A01A781F38006873D1.sh
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
/development/misc/react/AwesomeProject/node_modules/promise/lib/done.js:10
      throw err;
      ^

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:470:13)
    at Object.execFileSync (child_process.js:490:13)
    at _runIOS (runIOS.js:91:34)
    at runIOS.js:24:5
    at tryCallTwo (/development/misc/react/AwesomeProject/node_modules/promise/lib/core.js:45:5)
    at doResolve (/development/misc/react/AwesomeProject/node_modules/promise/lib/core.js:200:13)
    at new Promise (/development/misc/react/AwesomeProject/node_modules/promise/lib/core.js:66:3)
    at Array.runIOS (runIOS.js:23:10)
    at Object.run (/development/misc/react/AwesomeProject/node_modules/react-native/local-cli/cli.js:86:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)
grabbou commented 8 years ago

I saw you posted on StackOverflow as well - any luck so far? I am playing around with master at the moment and I can't reproduce. Maybe it's one of the problems described there, e.g. the sudo or permissions? Also do you have CFBundleIdentifier in your Info.plist ?

arun0009 commented 8 years ago

I tried deleting all my node modules, clear cache etc and sudo as well with no luck. I do have CFBundleIdentifier in the Info.plist as:

<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
dsibiski commented 8 years ago

@grabbou Are you trying it with Node 6? I haven't been able to reproduce it, but I've only tried so far with Node 4 & 5, haven't installed 6 yet. Perhaps it's an issue there?

arun0009 commented 8 years ago

@dsibiski I had node 5.9 before and I had the same issue, I uninstalled node/npm and deleted every node module and reinstalled (that's when I got node 6 on my machine) but I still am stuck with the above exception.

shinout commented 8 years ago

I also encountered a similar error.

On OS X El Capitan v10.11.4

node --version v6.0.0 npm --v 3.8.6 react-native-cli: 0.2.0 react-native: 0.24.1 watchman --v 4.4.0 xcode 7.3

$ react-native init AwesomeProject $ cd AwesomeProject $ react-native run-ios

\ BUILD SUCCEEDED **

The following commands produced analyzer issues: Analyze Modules/RCTUIManager.m (1 command with analyzer issues) Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist /Users/shinout/workspace/AwesomeProject/node_modules/promise/lib/done.js:10 throw err; ^

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:470:13)
    at Object.execFileSync (child_process.js:490:13)
    at _runIOS (runIOS.js:91:34)
    at runIOS.js:24:5
    at tryCallTwo (/Users/shinout/workspace/AwesomeProject/node_modules/promise/lib/core.js:45:5)
    at doResolve (/Users/shinout/workspace/AwesomeProject/node_modules/promise/lib/core.js:200:13)
    at new Promise (/Users/shinout/workspace/AwesomeProject/node_modules/promise/lib/core.js:66:3)
    at Array.runIOS (runIOS.js:23:10)
    at Object.run (/Users/shinout/workspace/AwesomeProject/node_modules/react-native/local-cli/cli.js:86:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)

In my case, BUILD seems to succeed. However, the process terminates with the error message above.

ms88privat commented 8 years ago

I got the same problem on one of my projects... You could kind work around with only XCode builds. I think it appeared after changing the name of the project.

arun0009 commented 8 years ago

I was able to solve this issue! Looks like port 8081 was in use :

lsof -n -i4TCP:8081
node    7601 CXI624   23u  IPv6 0xc6b249599e5f1169      0t0  TCP *:sunproxyadmin (LISTEN)

So I followed the instructions from React Native Troubleshooting https://facebook.github.io/react-native/docs/troubleshooting.html

kill - 9 7601

and ran the command react-native run-ios again and everything worked as expected (on node 6 as well).

Closing this issue & thanks for your help!

dsibiski commented 8 years ago

@arun0009 Awesome, thanks for posting the answer back here 👍

ghost commented 8 years ago

@shinout Hello, I have the same problem, you solve?

shinout commented 8 years ago

Not yet... I finally bought a new mac and solved.

consideRatio commented 8 years ago

I solved this issue with the react-native upgrade command, which helped me reset some details in various xcode files. At least that is what I think solved the issue.

stief510 commented 8 years ago

This isn't working for me. I'm still getting the same error. Node 5.11

andreacab commented 8 years ago

Still getting the error too. Killing process on port 8081 did not work. react-native-cli: 0.2.0 react-native: 0.26.2 node: 5.3.0 npm: 3.3.12

Tested with a new project setup by running $ react-native init newProj && cd newProj $ react-native run-ios

Typing the following doesn't give the issue but a "No devices are booted"..

sudo react-native run-ios

Had another react packager running on 8081. Killing that process made it to work.

stief510 commented 8 years ago

Running it with sudo does not solve it for me.

joshschumacher commented 8 years ago

The suggest solution by @consideRatio fixed this problem for me.

react-native upgrade
rjain15 commented 8 years ago

Worked after upgrading XCode to 7.3.1

bradennapier commented 8 years ago

Nothing posted here works for me unfortunately :(

rosiakr commented 8 years ago

In my case my ProductName got corrupted.

I had to change my project name, scheme name for my project and Product Name so they are all the same, and after that I started seeing the errors mentioned above. When I went to Info.plist to check what it says for my CFBundleIdentifier (or just "Bundle identifier" if you are viewing Info.plist in Xcode) I saw: com.{company}.mobile.$(PRODUCT_NAME:rfc1034identifier) So It's a path. So I decided to investigate in Xcode - I clicked on the project name in left pane and went to BuildSettings. Under Packaging my ProductName instead of being, say "MyAwesomeApp" was something like "MyAwesomeAppApp" - last part was repeated twice. Needless to say I had to change it to match my ProjectName (MyAwesomeApp), saved in Xcode and

$ react-native run-ios

worked w/out any problems. Now it makes sense why it was showing errors: "An application bundle was not found at the provided path. Provide a valid path to the desired application bundle." The "path" was wrong! Hope it helps someone.

yellowbang commented 8 years ago

If you have some other applications are always occupying port 8081 no matter how many times you have killed the process, try changing the port:

http://stackoverflow.com/questions/30216417/react-native-port-8081-already-in-use-packager-is-either-not-running-or-not-r

It solves my problem. Hope it helps someone.

idris commented 8 years ago

I still get the same Entry, ":CFBundleIdentifier", Does Not Exist error that this ticket mentions. I've tried:

Any other ideas?

Interestingly enough, everything works if I open the .xcworkspace in XCode and run it from there.

stief510 commented 8 years ago

What ended up working for me was that I needed to open up in XCode and change the scheme from building for a Release to Debug. Don't know if that will work for anyone else but it is definitely something to check out. After changing it once, you can then run it react-native run-ios via the command line

y0unghe commented 8 years ago

@joshschumacher upgrade worked.

gvlamadrid commented 8 years ago

When nothing fixes, try on Xcode

  1. Go to File -> Project settings
  2. Click the Advanced button
  3. Select "Custom" and select "Relative to Workspace" in the pull down
  4. click done, done
sydneyitguy commented 8 years ago

@stief510 That worked for me! Thanks!

trevorwang commented 8 years ago

As @gvlamadrid said

When nothing fixes, try on Xcode

  1. Go to File -> Project settings
  2. Click the Advanced button
  3. Select "Custom" and select "Relative to Workspace" in the pull down
  4. click done, done

5 pic

shargon commented 8 years ago

nothing work for me...

cpruijsen commented 8 years ago

Did not fix it for me (I killed ports, changed project settings, etc etc.)

shadowfax92 commented 8 years ago

Nothing worked for me too. Using node v6.2.2

tomazahlin commented 8 years ago

I tried all solutions, but nothing works. Great job, react native...

uusa35 commented 8 years ago

@trevorwang thank you so much it worked for me

VitamintK commented 8 years ago

My problem was also that I had something running on port 8081 (discovered by running sudo lsof -n -i4TCP:8081)

Fixed by using an older version of react-native by running react-native init --version 0.27 instead of react-native init to create the project.

Then, I changed the appdelegate.m file and the React.xcodeproj and the RCTWebSocketExecutor.m as detailed in the first step here.

Then, in the project folder, instead of react-native ios-run, I did npm start -- --port 5000, and then ran the project in Xcode with ⌘+R

ryanmcgrath commented 8 years ago

Mmmm, this issue is one of the top Google results for react-native apps not running in the simulator ("no devices are booted"). Since this seems to still be a lingering issue for people I'm dumping some info here - YMMV.

This used to happen to me when I did iOS work for a living; oftentimes the simulator is just wonky as hell. ps aux | grep Simulator will usually give me something to kill that should've died already. These steps usually work for me:

  1. Kill simulator/debug server.
  2. ps aux | grep Simulator or whatever your preferred shell magic is, see if anything is lingering around that didn't shut down correctly. If there's something, kill it.
  3. Re-run simulator/debug server/build process (react-native run-ios). If it still gives you a "no devices booted" error (and your simulator is a black screen), just reboot the simulator completely via Hardware -> Reboot, then open your app.

Unless you actually have something running on port 8081, you shouldn't need to change it - for some reason I see that as the most answered solution to this stuff around the web. These steps work for me pretty much every time.

Also, keep in mind if you change your NSAppTransportSecurity settings in your Info.plist, it can mess with this stuff.

Bintong commented 8 years ago

@joshschumacher works for me too

jamesone commented 8 years ago

Can confirm that react-native upgrade worked for me & that stopping processes running on port 8081 didn't as the process running on 8081 is being started by react-native run-ios

YuLinLee commented 8 years ago

Need to fix code manually. SecRandomCopyBytes -> (void)SecRandomCopyBytes in RCTSRWebSocket.m then tryreact-native run-ios again, it worked for me.

the-simian commented 8 years ago

@stief510 solution is exactly what got it done for me. Let me tell you how to do it. Click the Product menu in xcode, in the Scheme flyout menu, look at the bottom - you'll see Edit Click that. A modal menu appears. The Build configuration has a select box, make sure its set to Debug. Fixed it for me.

timbielawski commented 8 years ago

thanks @stief510 that worked after trying everything else

abz53378 commented 8 years ago

I just do npm install react-native-cli@latest -g, then react-native run-ios is work!

xvv6u577 commented 7 years ago

npm install react@latest react-native@latest,it works for me after upgrade xcode 7.x to 8.0.

ashihsKumar713 commented 7 years ago

react-native upgrade Works for me, thanks.

alanlavintman commented 7 years ago

Nothing works for me, upgraded ios to macsierra, xcode to 8.0, change the project build location, closed ports, upgrade react-native installed the latest cli. Nothing seems to work for the default react native tutorial.

The following build commands failed: Analyze RCTVibration.m (1 failure) Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist

Any ideas?

gavinxyang commented 7 years ago

Please re-open this, I still experience this, and this happen to both F8 app and Hacker news example app. We are really eager to use React Native for our project, but this bug kind of block us and we are afraid of such kind of problem will happen along the way.

My setup : macos sierra 10.12 xcode: Version 8.0 (8A218a) npm: 3.10.3 "react-native": "^0.20.0", "react-native-gifted-listview": "0.0.12", "react-native-scrollable-tab-view": "^0.3.8", "react-native-vector-icons": "^1.2.1", "react-native-activity-view": "^0.2.5"

The following commands produced analyzer issues: Analyze RCTImageLoader.m (1 command with analyzer issues)

The following build commands failed: CompileC /Users/xx/Downloads/HackerNews-React-Native-master/ios/build/Build/Intermediates/RCTWebSocket.build/Debug-iphonesimulator/RCTWebSocket.build/Objects-normal/x86_64/RCTSRWebSocket.o RCTSRWebSocket.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) Installing build/Build/Products/Debug-iphonesimulator/HN Reader.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist /Users/xx/Downloads/HackerNews-React-Native-master/node_modules/promise/lib/done.js:10 throw err; ^

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/HN Reader.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist

at checkExecSyncError (child_process.js:475:13)
at Object.execFileSync (child_process.js:495:13)
at _runIOS (runIOS.js:77:34)
at runIOS.js:24:5
at tryCallTwo (/Users/xx/Downloads/HackerNews-React-Native-master/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/xx/Downloads/HackerNews-React-Native-master/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/xx/Downloads/HackerNews-React-Native-master/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (runIOS.js:23:10)
at Object.run (/Users/xx/Downloads/HackerNews-React-Native-master/node_modules/react-native/local-cli/cli.js:86:13)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)
dmitrye commented 7 years ago

@alanlavintman I finally got to the same error message as you. At that point the issue was that AwesomeProject.app was in the wrong place. For me, it was NativeStarterKit.App. It was located under: ios/build/Products/Debug-iphonesimulator/NativeStarterKit.app So I copied it to: ios/build/Build/Products/Debug-iphonesimulator/NativeStarterKit.app

@gavinxyang The issue above or the 5th bullet point below could be your issue. Make sure the path reported in your "Command Failed" error actually exists for "HN Reader App" it may be in the build/Products folder instead.

There were other items I did before just to get to this point:

Now I'm getting JS errors in the App but at least everything builds. If you follow the errors listed with "Command Failed" they are the ones actually causing the break.

I hope this helps some people who are still stuck after all the previous fixes. This may also be tied to XCode 8.0 changing things around and react-native still not compliant.

Full Details: react-native-cli: 1.0.0 react-native: 0.31.0 node: 6.6.0 npm: 3.10.3 XCode: 8.0 Mac OSX: El Capitan 10.11.6

After 3-4 hours of debugging I finally have it working. Now I will go back and try again with Pepperoni that was originally throwing similar errors when I decided to switch to NativeStarterKit.

gavinxyang commented 7 years ago

Thanks, dmitrye@!

Here is how I fix it: 1) remove custom flags, so RCTScrollView.o can be compiled one more step further. (still fail) 2) Replace _refreshControl with refreshControl, and comment one line. https://github.com/facebook/react-native/issues/8472

However, I still insist re-open this bug, because these thing should not happen and really frustration. Also my fix is change react-native module itself. Hope react-native can fix this for xcode 8.0, which looks like a very common problem.

brianneisler commented 7 years ago

Finally got this working after reading @dmitrye 's comment. These steps just have a slight twist to @gvlamadrid 's instructions

How I fixed it.

  1. rm -rf ios/build
  2. Go to File -> Project settings
  3. Click the Advanced button
  4. Select "Custom" and select "Relative to Workspace" in the pull down
  5. When I selected this option it defaulted my paths to Build/Products and Build/Intermediates. I had to manually change these to build/Build/Products and build/Build/Intermediates

Seems the run-ios command was looking for the app in ios/build/Build/Products when it was actually being placed in ios/Build/Products. Just a hunch but maybe this has something to do with the way that mac ignores case when dealing with paths on the command line? Could be leading to the run-ios command getting tripped up. Or maybe the default path is just wrong.

I'm on XCode v8.0

yangjiqiao86 commented 7 years ago

Worked after upgrading dependencies "react-native": "0.34.0"

StevePotter commented 7 years ago

Fixed in my pull request. Upvote it please.

kennethlynne commented 7 years ago

Downgrading Xcode 8 -> Xcode 7.3.1 fixed the issue for me

CEOGavin commented 7 years ago

This solution worked for me - https://medium.com/@alberto.schiabel/react-native-on-xcode-beta-8-0-how-to-fix-initial-build-error-f0225c649850#.t0m08cocz

The0racle commented 7 years ago

@CEOGavin link worked for me BUT I gotta run from XCode. react-native run-ios still gives me the error.

Running react native v0.31. Can't upgrade yet.