expo-cli successfully updating to 3.11.3 but actually not.

Expo CLI 3.4.1 environment info:
    System:
      OS: Windows 10
    Binaries:
      Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD

See my red highlights below. Things seem to update but then… not.
I tried yarn cache clean and then re-updating with no success.

I’ve never run into this one before. Any ideas?

there is some problem with your npm / yarn paths. if you type which expo you can see where it is installed to. then try installing some other package that you haven’t installed globally before, like serve maybe, with yarn global add serve. next run which serve and it’ll probably not be the same place. i suspect you recently installed node or yarn differently than how you did in the past.

edit: my bad you are using windows so you will have to use whatever the windows equivalent of which is

As Brent said there’s a problem with your PATH.

I suspect you have version 3.4.1 installed by npm in your PATH and the version that is being installed by yarn is not in your PATH (or is later in your PATH than the npm-installed one) so PowerShell can’t find it.

I suggest you uninstall the version that was likely installed by npm:

npm uninstall -g expo-cli

and then run yarn bin to see where it likely installed the latest version of expo-cli. Then add that directory to your PATH. (e.g. see Add to the PATH on Windows 10 | Architect Ryan)

EDIT:

You ought to be able to run the following script to see where there are expo binaries in your PATH. I haven’t tried it on Windows, but I believe it should work correctly there too:

const path = require("path");
const fs = require("fs");

const dirs = process.env.PATH.split(path.delimiter);

for (const dir of dirs) {
  for (const ext of ["", ".exe"]) {
    const expoPath = path.resolve(dir, `expo${ext}`);

    try {
      if (fs.existsSync(expoPath)) {
        console.log(`Found: ${expoPath}`);
      }
    } catch (err) {
      console.error(err);
    }
  }
}

Save the above to a file called expoPath.js and then run:

node expoPath.js

Thanks @notbrent and @wodin.

The problem was that expo had gotten installed via npm. Not sure how that happened. I never use npm, always yarn.

Simply running npm uninstall -g expo-cli and then expo -V showed the correct version. :+1:

3 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.