'Command not found' 尝试全局安装 expo 时 ubuntu

'Command not found' when trying to install expo globally ubuntu

当我安装 expo 时,它安装了但没有安装。以下是有关该问题的详细信息。

我先输入:

yarn global add expo-cli@4

安装时显示:

warning package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "expo-cli > xdl > @expo/dev-server > @expo/metro-config > metro-react-native-babel-transformer@0.59.0" has unmet peer dependency "@babel/core@*".
[4/4] Building fresh packages...

当我使用 yarn 安装 expo 时,我得到:

Installed "expo-cli@4.12.0" with binaries:
      - expo
      - expo-cli
Done in 4.30s. 

但是当我输入 'expo --version' 时,我得到:

Command 'expo' not found, did you mean:

      command 'exo' from snap exoscale-cli (v1.22.2)
      command 'expn' from deb sendmail-base (8.15.2-18)
      command 'expr' from deb coreutils (8.30-3ubuntu2)
    
    See 'snap info <snapname>' for additional versions.

根据您发布的内容,我假设 yarn 安装全局节点模块的文件夹不在您的路径中。

尝试以下方法之一:

  1. 尝试使用 npm(可能在您的路径中)进行全局安装

npm i -g expo-cli

  1. 将 yarn 全局文件夹添加到路径:

echo PATH="$PATH:$(yarn global bin)" >> ~/.bash_profile

查看此线程了解更多信息:

1:进入终端,先输入这个

导出路径=$路径:~/.npm-global/bin

2:在这个命令之后输入这个

来源 ~/.bash_profile