首页 > 解决方案 > 尝试全局安装 expo 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...

当我使用纱线安装博览会时,我得到:

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.

标签: linuxubuntuexpoyarnpkg

解决方案


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

尝试其中之一:

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

npm i -g expo-cli

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

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

有关更多信息,请参阅此线程:纱线全局命令不起作用


推荐阅读