简体   繁体   中英

Unable to get started with a new Expo project | Node.js version 14.0.0 is no longer supported

I am just getting started with Expo and trying to create my first project. I installed Node.js (v14.0.0) via Homebrew , and installed installed expo-cli using npm by running the following command as mentioned in the Expo quick start guide :

# Install the command line tools
npm install --global expo-cli

# Create a new project
expo init my-project

However, I received an error when running the expo init my-project command which looks like this:

ERROR: Node.js version 14.0.0 is no longer supported.

expo-cli supports following Node.js versions:

  • >=10.13.0 <11.0.0 (Active LTS)

  • >=12.0.0 <13.0.0 (Active LTS)

  • >=13.0.0 <14.0.0 (Current Release)

I tried running expo , expo-cli , expo diagnostics , and I keep getting the same error message every time. I am practically unable to run expo command .

I checked Node.js release notes , and turns out Node.js has recently been bumped to version 14.x.

Can someone familiar with Expo development and release timelines help with what should be the recommend approach here out of the following two?

  1. Downgrade to an older stable and Expo supported version of Node.js.

  2. Wait for an update to Expo (only if an update to Expo is in pipeline to be released soon).

I am using a Mac running the current latest public release of macOS Catalina version 10.15.4 (19E287).

The best solution is to downgrade to a node version supported by expo-cli using brew .
Just run the following commands:

brew unlink node
brew install ${MAX_ALT_NODE=$(brew search node | grep node@ | sort -rn | head -n 1)}
brew link --overwrite --force $MAX_ALT_NODE

And you're done! expo-cli is back on track!


Explanation:

#unlink current node version so we can install another version
brew unlink node
#install the highest alternative node version available with `brew`
brew install ${MAX_ALT_NODE=$(brew search node | grep node@ | sort -rn | head -n 1)}
#force link this version to use it instead of default node version
brew link --overwrite --force $MAX_ALT_NODE

Notes:

  • as these commands get the highest alternative node version available with brew dynamically installed, it would work in the future too.
  • a pull request fixing the current issue has been merged in the official expo-cli repo and thus should soon be available.

Working @ May 2020

$ brew uninstall node  --ignore-dependencies node
$ brew install node@12
$ brew link --force --overwrite node@12

You should use Node 12.js version. Expo takes some time to support new releases of Node. So the best bet is to downgrade your Node to version 12 which is currently supported. I had similar issue recently with backward compatibility. See these comments. Stackoverflow

Same problem today, I'm using nvm and selected node version is v13.7.0. The solution was to upgrade expo-cli to latest version (expo-cli@3.20.9).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM