Ville Miekk-oja
Ville Miekk-oja

Reputation: 20985

react-native link does not find project.pbxproj file

I have a react-native project where I changed my project name in package.json due to eslint warnings. Now when I try to run react-native link to link any library, I'm getting the following error:

Scanning folders for symlinks in /Users/my-username/projects/myproject-folder/node_modules (20ms)

rnpm-install info Linking assets to ios project

rnpm-install ERR! Something went wrong while linking. Error: ENOENT: no such file or directory, open '/Users/my-user-name/projects/myproject-folder/ios/my-old-app-name.xcodeproj/project.pbxproj'

So it doesn't find the file project.pbxproj, as it is looking at it from the wrong folder.

What I have tried so far with failed outcomes:

  1. react-native upgrade
  2. react-native-rename
  3. Deleted node_modules and run npm install again
  4. Renamed app name to correct in index.ios.js for AppRegistry.registerComponent

Where does react-native link look for the file project.pbxproj? If I find that location, I could rewrite it to the new correct one. I have no xcode, and currently only android version. I (still) have the separate index files for both versions, even I heard that after some react-native upgrade they should have been merged...

Upvotes: 0

Views: 3588

Answers (2)

keysl
keysl

Reputation: 2167

I stumbled this problem just today. Here are the steps I made to make it work again

  • Delete the ios folder
  • react-native eject // this will re generate the ios folder
  • react-native-link

I also did gradle clean before the earlier steps but I think its unnecessary.

Upvotes: -1

Ville Miekk-oja
Ville Miekk-oja

Reputation: 20985

Was able to solve this by deleting the other project folders in the ios -folder. Apparently react-native just loops through every project there it finds, and picks the first one.

Upvotes: 7

Related Questions