xcode using wrong node.js version

前端 未结 6 544
闹比i
闹比i 2020-12-30 00:25

I am new to React Native. I used react-native init XXX to create a new project. When launch the xcodeproj, I got an error saying:

  const setupE         


        
6条回答
  •  清酒与你
    2020-12-30 01:08

    For me, adding this to /etc/profile or to ~/.profile worked:

    export NVM_DIR="$HOME/.nvm"
    [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  
    

    The reason this is necessary is because XCode uses /bin/sh by default and it loads the profiles from the files I specified.

    Note: altering /etc/profile requires you to use sudo. Not sure if this is even possible on MacOS X 10.15 Catalina since I believe they made the system directories to be read-only, no matter what. But if you are able to set it here, this will make it work for any user who has nvm installed.

提交回复
热议问题