升级后expo-cli版本错误

Dan*_*ter 4 expo

很多时候,我在启动 expo 项目后收到以下信息消息,并且似乎无法升级 expo-cli:

There is a new version of expo-cli available (4.2.1). You are currently using expo-cli 3.28.0 Install expo-cli globally using the package manager of your choice; for example: npm install -g expo-cli to get the latest version

这看起来似乎更容易。全局安装expo-cli后没有错误 + expo-cli@4.2.1

好的,现在我输入 expo -V 来检查新版本,但请稍候:它的 3.28.0 我的项目 package.json 中没有 expo-cli。有没有办法找到使用的 expo 版本?

编辑:

到目前为止我找到了 1 个 PATH 文件。(C:\Users\myuser.expo) 其内容:

C:\Users\SYSTEM~1\AppData\Local\Temp\yarn--1615049876273-0.687029522126771;
C:\Users\myuser\WfManager\fmapp\node_modules\.bin;
C:\Users\myuser\AppData\Local\Yarn\Data\link\node_modules\.bin;
C:\Program Files\libexec\lib\node_modules\npm\bin\node-gyp-bin;
C:\Program Files\lib\node_modules\npm\bin\node-gyp-bin;
C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;
C:\Program Files (x86)\Lenovo\FusionEngine;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;
C:\Program Files (x86)\Common Files\Apple\Apple Application Support;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\System32\OpenSSH\;
C:\xampp\php;
C:\Program Files\Git\cmd;
C:\Program Files\PuTTY\;
C:\Program Files\Symfony;
C:\Program Files (x86)\Yarn\bin\;
C:\Program Files\nodejs\;
  C:\composer;
C:\Users\myuser\AppData\Local\Microsoft\WindowsApps;
C:\Users\myuser\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Users\myuser\AppData\Roaming\Composer\vendor\bin;
C:\Users\myuser\AppData\Local\Yarn\bin;
C:\Users\myuser\AppData\Local\GitHubDesktop\bin;
C:\Users\myuser\AppData\Roaming\npm
Run Code Online (Sandbox Code Playgroud)

写下此内容并检查条目后,我发现一个链接到旧版本的条目:

C:\Users\myuser\AppData\Local\Yarn\Data\link\node_modules\.bin; //old version

C:\Users\myuser\AppData\Roaming\npm  //new version`
Run Code Online (Sandbox Code Playgroud)

我现在想用 xarn global 更新 expo-cli,我们看看会发生什么。

小智 5

您可以使用 检查二进制文件的路径command -v expo

在这种情况下,您很可能使用npm和yarn全局安装了expo-cli,版本3.28.0只是您的PATH. 您也可能安装了两个节点版本(和 2 个 npm 版本),但可能性较小。