react-native: searchPaths.filter is not a function, when unlinking
Description
i tried unlinking a library and i got an error
react-native unlink react-native-video
Scanning 870 folders for symlinks in /Users/pvinis/Source/mycujoo/mycujoo-mobile/node_modules (9ms)
rnpm-install info Unlinking react-native-video ios dependency
rnpm-install ERR! It seems something went wrong while unlinking. Error: searchPaths.filter is not a function
searchPaths.filter is not a function
Reproduction Steps and Sample Code
try to link and then unlink a library i guess.
Solution
no idea.
Additional Information
- React Native version: 0.42.3
- Platform: iOS
- Development Operating System: MacOS
- Dev tools: Xcode
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 20
- Comments: 24 (2 by maintainers)
Commits related to this issue
- package.json: upgrade xcode to 1.0.0 (cordova-node-)xcode 1.0.0 includes a fix for #13160 plus a few more fixes. This should increase robustness in Xcode project handling overall. Fixes #13160. — committed to peat-psuwit/react-native by peat-psuwit 6 years ago
- Bump xcode@1.0.0 (cordova-node-)xcode 1.0.0 includes a fix for #13160 plus a few more fixes. This should increase robustness in Xcode project handling overall. Fixes #13160. — committed to peat-psuwit/react-native by peat-psuwit 6 years ago
- Bump xcode@1.0.0 (#21766) Summary: (cordova-node-)xcode 1.0.0 includes a fix for #13160 plus a few more fixes. This should increase robustness in Xcode project handling overall. Fixes #13160. -----... — committed to facebook/react-native by peat-psuwit 6 years ago
- Bump xcode@1.0.0 (#21766) Summary: (cordova-node-)xcode 1.0.0 includes a fix for #13160 plus a few more fixes. This should increase robustness in Xcode project handling overall. Fixes #13160. -----... — committed to facebook/react-native by peat-psuwit 6 years ago
- Bump xcode@1.0.0 (#21766) Summary: (cordova-node-)xcode 1.0.0 includes a fix for #13160 plus a few more fixes. This should increase robustness in Xcode project handling overall. Fixes #13160. -----... — committed to microsoft/react-native-macos by peat-psuwit 6 years ago
my quick fix: file: /node_modules/react-native/node_modules/xcode/lib/pbxProject.js line 1146: change the condition from
if(searchPaths)
toif (searchPaths && searchPaths !== '"$(inherited)"')
hey @qruzz . It’s been a while, but I think I remember what I was talking about:
Somewhere near the bottom of the file, you’ll have your build configurations. In here there are several build settings, including
HEADER_SEARCH_PATHS
,FRAMEWORK_SEARCH_PATHS
, andLIBRARY_SEARCH_PATHS
.react-native unlink
seems to be expecting these to be lists in all cases, but many projects just have one value as inInstead, as a workaround, you should make them into a list:
I change the follow bit of code in the
/node_modules/xcode/lib/pbxProject.js
to
and it seemed to have fixed the issue as well.
Confirmed on RN 0.51, when running
$ react-native unlink react-native-sentry
:can confirm this still happens in react-native 0.53! its neither stale nor fixed. Please re-open
@minhtc solution worked, but the file was at
/node_modules/xcode/lib/pbxProject.js
react-native0.47.1
still there in 0.51.0
After a bit of detective work (threw console.log statements throughout /node_modules/xcode/lib/pbxProject.js to see what part of the project file it was choking on) it seems like the installer was expecting my project to have a ‘Plugins’ group that I didn’t have, I created an empty one in the project. My top level project groups now look like this:
I also opened up ios/<ProjectName> and made sure that every variable that ended in *_SEARCH_PATHS was a list, it appears like xcode uses a string for single element lists, so I just wrapped parenthesis around those variables, after that I ran
react-native unlink
andreact-native link
again without issue.Perhaps the xcode library needs to be patched and/or there needs to be some exception handling for missing groups / lists that only have a single entry that are being treated as strings?
Please re-open it. I also encounter this issue when I run
$ react-native unlink react-native-sentry
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.
@minhtc I didn’t find this js file. Instead, I made all of the framework, header, and library search paths in
ios/<projectName>.xcodeproj/project.pbxproj
a list. Some of them were individual strings, but you can list them by surrounding the one string with (parentheses)