React-native: "react-native link" error

Created on 12 Apr 2017  路  35Comments  路  Source: facebook/react-native

I tried to run react-native link after running npm install, this was working fine before now I got this error
ERR! It seems something went wrong while linking. Error: Expected "/* Begin ", "/* End ", "\"" or [A-Za-z0-9_.] but "<" found. Please file an issue here: https://github.com/facebook/react-native/issues

What causes this error?

Stale

Most helpful comment

@dillonykyang I had a similar issue.

Before using the link command, change all the HEADER_SEARCH_PATHS that have a mono-string value

HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native-navigation/ios/**";

to a multi-string value:

HEADER_SEARCH_PATHS = (
  "$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
);

The link command should work properly now.

All 35 comments

what libs are you linking? and please provide full error log

Hi,

I got the same error ! and i cannot open my xcode project now.

I got the same error ! and i cannot open my xcode project now.

@Fantasim you can always use git checkout -- <yourproj>.xcodeproj to reset this change.

@EgaSetya @Fantasim Can you provide us a name of the library that causes this issue? Without it, we can't do anything.

Just encountered the same error. It seems to be caused by a corrupt .xcodeproj file because the linking fails on the first iOS module it encounters.

@Fantasim @EgaSetya we were able to fix it by checking out an older version of the .xcodeproj file that worked and then ran link again.

As @Kureev said, please provide the name of the library you use and full log.
right now it looks like there is a problem with the library you are linking itself and not react-native.

Until we see what library or error this is we can not do anything.

It's not specific to any library. I deleted the libs one by one to confirm this and the problem still occured.

As I said, it seems to be purely because of the corrupt .xcodeproj file. Android modules were still linking fine, it failed on the first iOS module in the alphabetical order of installed libs. Restoring the .xcodeproj to the last non-corrupt version fixed it with the same set of installed libs.

@stoffern @Kureev Where can I find full error log? I only got 2 line of error when running "react-native link" on terminal

@naoey I tried running "git checkout -- myproject.xcodeproj" and got this error error: pathspec 'Pictalogi.xcodeproj' did not match any file(s) known to git.

You need to give the full path, which will be ios/Pictalogi.xcodeproj

If you've already committed the corrupt file you need to specify a previous commit revision when checking out.

@naoey I haven't committed the file yet and I already try as you suggested but it caused the same error.

Can you share the diff of corrupted file so we can check where react-native link corrupts it?

I'm very sorry for this experience. I didn't experience this issue so far, so I need your assistance in order to fix it fast and efficiently. Please, be patient. Once we have a diff, we can find the right spot in the code that breaks it out.

I have the issue with this library https://github.com/xinthink/react-native-material-kit

These lines (diff) are causing the error:

-               HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native-navigation/ios/**";
+               HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native-navigation/ios/**""$(SRCROOT)/../node_modules/react-native-material-kit/iOS/RCTMaterialKit";

@Kureev @stoffern I got so many line diff on my project.pbxproj(link to file). Do I have to fix this manually?

@dillonykyang I had a similar issue.

Before using the link command, change all the HEADER_SEARCH_PATHS that have a mono-string value

HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native-navigation/ios/**";

to a multi-string value:

HEADER_SEARCH_PATHS = (
  "$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
);

The link command should work properly now.

@EgaSetya Yes, you do. You'll find some useful information in this thread #12261, starting from this post: https://github.com/facebook/react-native/issues/12261#issuecomment-282592590

You should do the same for

LIBRARY_SEARCH_PATHS = "$(inherited)";

multi-string value does not resolve thit issue

mac osx sierra:

    "react": "15.4.1",
    "react-native": "0.39.2",

I've the same issue!

I got same issue.

Similar if not same issue here. My error message:

ERR! Something went wrong while linking. 
Error: Cannot read property 'nodeValue' of undefined 

I have created the new project with same name, installed the npm module again using the npm install.
resolved the issue.

Same probleme here. I tried to inspect the pbxproj whith no success.

I had this same error too when installing 0.6.1. I reverted and installed 0.6.0 as was suggested and that worked. The HEADER_SEARCH_PATHS were already a multi-string value.

I too found that using 0.6.0 solved the linking issue.

@ncuillery thanks ,i resolved the issue.

Make sure to git diff your *.pbxproj

In our case, there's a lot of "conflicts". So the Xcode can't parse the project.

screen shot 2017-11-03 at 8 29 49 am

I Can't Find HEADER_SEARCH_PATHS for android, Where is that?

@mochadwi thank u man.. u save my day..

Have you tried doing react-native upgrade before react-native link? That worked for me.

@percivalruiz-bibo this is not the case, it is merge conflicts in project.pbxproj file

This error seems to be related to Info.plist to me.

Steps to reproduce on my project:

  1. react-native link: FINE, but Info.plist was changed.
  2. react-native link: ERR! Something went wrong while linking. Error: Cannot read property 'nodeValue' of undefined
  3. I revert changes made to Info.plist
  4. react-native link: FINE, but Info.plist was changed again.
  5. react-native link: ERR! Something went wrong while linking. Error: Cannot read property 'nodeValue' of undefined

Environment: I tested this on Windows and Mac:

"react": "16.3.1", 
"react-native": "0.55.2",

Below are the changes made on my Info.plist when running react-native link:
changes_infoplist

Edit:

I just realized this problem occurs when using/linking react-native-vector-icons. When I remove this dependency, the error disappears.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@mochadwi The text used now are ours and theirs, instead of HEAD.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

axelg12 picture axelg12  路  3Comments

madwed picture madwed  路  3Comments

lazywei picture lazywei  路  3Comments

DreySkee picture DreySkee  路  3Comments

janmonschke picture janmonschke  路  3Comments