Stock React Native app won't build on iOS (asdf?)

1.7k Views Asked by At

I'd like some help getting a stock app running following the official Getting Started.

I downloaded iOS simulator 14.3.

I run

npx react-native init nuproject

cd nuproject

npx react-native run-ios

I get

nvm is not compatible with the "PREFIX" environment variable: currently set to "/Users/me/.asdf/installs/nodejs/15.8.0/.npm"
Run `unset PREFIX` to unset it.
nvm is not compatible with the "PREFIX" environment variable: currently set to "/Users/me/.asdf/installs/nodejs/15.8.0/.npm"
Run `unset PREFIX` to unset it.
Command PhaseScriptExecution failed with a nonzero exit code


** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/me/Library/Developer/Xcode/DerivedData/nuproject-enujsutisqszfkeohcvaepmqnist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-C635E97B268646534DBB9F9667109A6E.sh
(1 failure)

Here's my react-native env if it can help

$ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 11.2.3
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
    Memory: 80.10 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.8.0 - ~/.asdf/installs/nodejs/15.8.0/bin/node
    Yarn: 1.22.10 - ~/.asdf/installs/nodejs/15.8.0/.npm/bin/yarn
    npm: 7.5.1 - ~/.asdf/installs/nodejs/15.8.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_242 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.64.0 => 0.64.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
2

There are 2 best solutions below

3
On BEST ANSWER

Turns out I hadn't fully removed nvm from my system.

rm -rf ~/.nvm

And that fixed it.

0
On

Seems kinda straightforward, that your solution might be to make sure the PREFIX variable is unset.

One alternative you have is to install Node via NVM rather than managing Node within ASDF environment. I use ASDF environment also but I dont use ASDF for python or node. For those, i manage the installs outside of ASDF.