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
try to link and then unlink a library i guess.
no idea.
my quick fix:
file: /node_modules/react-native/node_modules/xcode/lib/pbxProject.js
line 1146:
change the condition from if(searchPaths)
to if (searchPaths && searchPaths !== '"$(inherited)"')
@minhtc this worked for me. Thank you!
@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)
+1
@mienaikoe Could you expand on that?
I am looking at that file, but have no idea what I am looking for?
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
, and LIBRARY_SEARCH_PATHS
. react-native unlink
seems to be expecting these to be lists in all cases, but many projects just have one value as in
HEADER_SEARCH_PATHS = "$(inherited)"
Instead, as a workaround, you should make them into a list:
HEADER_SEARCH_PATHS = (
"$(inherited)",
);
@mienaikoe Thank you very much for the reply !
Unfortunately, that did not solve the problem for me either ..
All my HEADER_SERCH_PATHS
were lists already, but had to change all the LIBRARY_SEARCH_PATHS
.. There were however no FRAMEWORK_SEARCH_PATHS
in my project, but instead a LD_RUNPATH_SEARCH_PATHS
instead, that I also changed into lists.
Keep happening to me as well (0.46.4), anyone found a proper fix for it?
@kelset Were you able to find a solution? Happening to me as well.
@minhtc solution worked, but the file was at /node_modules/xcode/lib/pbxProject.js
react-native 0.47.1
@ugiacoman sorry, not being able to fix it :/ Maybe with 0.48? I'll try to upgrade to latest once it comes out, let's see what happens then
Same issue with react-native 0.49.1
react-native unlink lottie-ios
Scanning folders for symlinks in /Users/[...]/node_modules (18ms)
rnpm-install info Unlinking lottie-ios 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
I change the follow bit of code in the /node_modules/xcode/lib/pbxProject.js
if (searchPaths) {
var matches = searchPaths.filter(function(p) {
return p.indexOf(new_path) > -1;
});
matches.forEach(function(m) {
var idx = searchPaths.indexOf(m);
searchPaths.splice(idx, 1);
});
}
to
if (searchPaths) {
if(typeof searchPaths === 'string'){
searchPaths = [searchPaths]
}
var matches = searchPaths.filter(function(p) {
return p.indexOf(new_path) > -1;
});
matches.forEach(function(m) {
var idx = searchPaths.indexOf(m);
searchPaths.splice(idx, 1);
});
}
and it seemed to have fixed the issue as well.
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.
still there in 0.51.0
Confirmed on RN 0.51, when running $ react-native unlink react-native-sentry
:
It seems something went wrong while unlinking. Error: searchPaths.filter is not a function
I'm also seeing this in RN 0.51 is the typical process to re-open an issue or create a new one?
@pvinis, re-open please? And this obviously isn't stale
as it's still happening.
Please re-open it. I also encounter this issue when I run $ react-native unlink react-native-sentry
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/react-native unlink
and react-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?
can confirm this still happens in react-native 0.53! its neither stale nor fixed. Please re-open
Saw now that the alunny/node-xcode
moved to apache/cordova-node-xcode
, therefore is unmaintained. There they've already fixed it see here.
~Need to update the dependency.~
New findings: it turns out that the offending package is not even from react-native
, thus I think this issue can be closed actually.
This is what I see with npm list xcode
[email protected] /myapp/path
โโโฌ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โ โโโ [email protected]
โโโ [email protected]
This keeps happening and is not isolated to any particular library. I'm now on RN 0.54.4 and:
$ react-native unlink react-native-vector-icons
Scanning folders for symlinks in <app>/node_modules (18ms)
rnpm-install info Unlinking react-native-vector-icons ios dependency
rnpm-install ERR! It seems something went wrong while unlinking. Error: searchPaths.filter is not a function
Re-open this.
0.55.3 and it is still a problem, but as @pietro909 mentioned it appears to be a problem with a dependency, not React Native itself. The same basic fix from @minhtc still works with a few updates:
"$(inherited)"
is not the only string that can appearThe current solution:
/node_modules/xcode/lib/pbxProject.js
if (searchPaths)
&& Array.isArray(searchPaths)
to each match
Most helpful comment
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)"')