【问题标题】:uname/ps/readlink/dirname - command not found issue in react-native while installinguname/ps/readlink/dirname - 安装时在 react-native 中找不到命令问题
【发布时间】:2022-01-24 21:59:26
【问题描述】:

我在安装我的 react-native 项目时遇到此错误 -

/Users/username/.rvm/scripts/rvm: line 12: uname: command not found
/Users/username/.rvm/scripts/rvm: line 29: ps: command not found
/Users/username/Desktop/Applications/SegmentTestApp/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh:
line 27: readlink: command not found
/Users/username/Desktop/Applications/SegmentTestApp/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh:
line 27: dirname: command not found
/Users/username/Desktop/Applications/SegmentTestApp/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh:
line 27: cd: : No such file or directory Command PhaseScriptExecution
failed with a nonzero exit code

这是我的 ~/.zshrc 文件 -

export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

环境-

❯ echo $PATH
/Users/<username>/.rvm/gems/ruby-3.0.0/bin:/Users/<username>/.rvm/gems/ruby-3.0.0@global/bin:/Users/<username>/.rvm/rubies/ruby3.0.0/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/<username>/Library/Android/sdk/emulator:/Users/<username>/Library/Android/sdk/tools:/Users/<username>/Library/Android/sdk/platform-tools:/Users/<username>/.rvm/bin

【问题讨论】:

    标签: ios ruby xcode react-native xcode-command-line-tools


    【解决方案1】:

    解决方案 #1

    日志中的以下错误消息表明命令行工具无法理解 unameps RVM 脚本中的引用。

    /Users/username/.rvm/scripts/rvm: line 12: uname: command not found
    

    我很好奇uname的下落,所以我这样做了-

    > which uname
    /usr/local/opt/coreutils/libexec/gnubin/uname
    

    如上所示,此路径已添加到我的 .zshrc 文件中,但仍未解决问题。

    打开 RVM 脚本后,我知道它不是使用 zsh shell,而是使用 bash shell,所以我在最后的 .bash_profile 文件中添加了这个 uname 路径 -

    export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH
    

    它开始工作了。

    解决方案 #2

    其他替代解决方案是将 rvm 脚本的 shell 从 zsh 更改为 bash。只需更改脚本的第一行

    #!/usr/bin/<<shell name - bash/zsh>>
    

    【讨论】:

      猜你喜欢
      • 2015-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-08
      • 2019-10-15
      • 1970-01-01
      • 2017-11-02
      相关资源
      最近更新 更多