react-native: Error when linking: "Expected "/*", "//" or "{" but "<" found"
Issue Description
When running react-native link, I get some kind of parse error. However, this parse error is impossible to debug, because it doesn’t give me any filename, line number, or column number.
I was told to file an issue at https://github.com/rnpm/rnpm/issues but that directed me to file issues here instead.
Steps to Reproduce / Code Snippets
% react-native link
rnpm-install info Android module react-native-maps is already linked
rnpm-install ERR! It seems something went wrong while linking. Error: Expected "/*", "//" or "{" but "<" found.
Please file an issue here: https://github.com/rnpm/rnpm/issues
Expected "/*", "//" or "{" but "<" found.
Expected Results
No idea. I did it because these instructions tell me to.
Additional Information
- React Native version:
% react-native --version
react-native-cli: 1.0.0
react-native: 0.33.0
- Platform(s) (iOS, Android, or both?): Both
- Operating System (macOS, Linux, or Windows?): macOS
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 25
- Comments: 73 (2 by maintainers)
Commits related to this issue
- react-native-fbsdk-0.6.1 — committed to facebookarchive/react-native-fbsdk by dzhuowen 7 years ago
+1 same problem as Deevent’s I change react-native install react-native-fbsdk to npm install react-native-fbsdk@0.6.0 --save react-native link react-native-fbsdk
This really should not be closed. This has been an ongoing problem for some time.
Ran into this after
react-native install react-native-fbsdk. Xcode then failed to open the project, and looking at the git diff I discovered myproject.pbxprojfile was written incorrectly like so:All was well once I changed to format:
@Tawfeekamr On Monday morning I set up a fb login for android. With version 0.6.0 there was a bug with java dependencies. After I fixed it with android everything was fine. Today I wanted to set up on iOs but because of this problem I did not have time. I’ll set up tomorrow if everything works out. I will rely on this instruction and from react-native-fbsdk examples =)
Update:
npm install react-native-fbsdk@0.6.0 --save react-native link react-native-fbsdk npm install plist xcode adm-zip --save-dev cp ./node_modules/react-native-fbsdk/ios_setup.js ./ios_setup.js node ./ios_setup.js [App ID] [App Name]
add changes from this file (don’t forget change “HelloFacebook” to your app)
I have the exact same issue trying to link react-native-fbsdk and I’ve checked my *.pbxproj and it’s all good.
In my case,
react-native-fbsdkwas also giving this error when linking and the way I solved it with 0.6.1 was to opennode_modules/react-native-fbsdk/ios/ios.xcodeprojon XCode, go to the Build Settings of the project, change some key => save => revert key value => save.After that, the project.pbxproj inside ios.xcodeproj was updated to the new format (checked with a texteditor) and I could finally run
react-native link react-native-fbsdkI had something similar too, I was getting:
Comparing with an older version of my code which worked, it looked like the problem was inside my iOS
project.pbxprojfile. The top line was:Removing the leading space fixed the problem for me:
I was using 0.6.1 and I got the same error, so I did:
npm install react-native-fbsdk@0.6.0 --save react-native link react-native-fbsdk
Works well!
Downgrading
react-native-fbsdkfrom0.6.1to0.6.0solved the problem for me!The fix that worked for me for 0.6.1
cd to_your_projectnpm install react-native-fbsdk@0.6.1 --saveopen node_modules/react-native-fbsdk/ios/ios.xcodeprojcreate some group delete the groupreact-native link react-native-fbsdkThis was reliably working for me on one system and not on another, so managed to narrow this down to being an encoding issue. We were able to confirm this using a freshly init’ed project using the latest cli (2.0.1).
A successful workaround for me is to explicitly unset the LANG environment variable when running link or install (install is a wrapper around npm install/yarn add and link):
Does this work for anyone else?
@BATMAH69 @edencakir I can confirm that it just worked for me 🎉 . Thx for the hint @BATMAH69
i use a cleanup/install script which works for me, maybe can help you guys as well package.json
cleanup.sh
feel free to ignore the cleanup part on the script
for some unknown reasons if you don’t install
react-native-fbsdk@0.6.0before linking, it will return error in thereact-native linki’ll let you guys know if i figured it out 😃@edencakir Seems its work =)
I downgraded to
react-native-fbsdk@0.6.0and it worked for me.For Android,
react-native@0.47.1@vvavepacket versions 0.5.1 and 0.6.1 were broken by commits on Jun 16, 2017 Version 0.5.1 was working until this commits. So you can update version to 0.6.0.
@dzhuowen It seems the problem was somewhere in this commit.https://github.com/facebook/react-native-fbsdk/commit/a5bf87c63b6e037afce5ff439f8bbe4051fcf79d
@BATMAH69 … and that worked?
This solved it for me
https://github.com/CocoaPods/CocoaPods/issues/1275#issuecomment-22391200
Still have the issue on the latest version. Reverted to 0.6.0 and it links fine.
The problem is - as far as I see - that the
project.pbxprojgets corrupted. I assume this may have multiple reasons.In my case:
was incorrectly changed to
instead of
My steps to solve it:
git diffor diff tool of trust).react-native linkorreact-native link <MODULE-NAME>.@jaimecorrea ,your solution worked for me. Thanks…
Thanks for the hint @BATMAH69. Worked for me as well. I unlinked and removed and then installed version 0.6.0 using Yarn and linked without any issues.
+1, this is happening to me on every link no matter what library, same versions as OP.