13

I'm using Expo with React Native but when trying to create a new project I get the error:

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

expo-cli supports following Node.js versions:
* >=8.9.0 <9.0.0 (Maintenance LTS)
* >=10.13.0 <11.0.0 (Active LTS)
* >=12.0.0 (Current Release)

$ node --version

v11.13.0

$ npm install npm@latest -g

...lib/node_modules/npm/bin/npx-cli.js
+ npm@6.10.3`
added 6 packages from 4 contributors, removed 11 packages and updated 36 packages in 9.92s

$ node --version

v11.13.0

$ expo init myApp

...throws same error above again.

EDIT: $ which node

/Users/hasen/.nvm/versions/node/v11.13.0/bin/node

$ /usr/local/bin/node --version

v10.16.2

Hasen
  • 11,710
  • 23
  • 77
  • 135
  • 3
    You're updating npm but not node, try updating node with apt if you're on linux, or use `npm install -g n` and then `n latest` – Onlinogame Aug 13 '19 at 12:25
  • @Onlinogame I looked up how to update node and everywhere said that the procedure is `$ npm install npm@latest -g` to update node. – Hasen Aug 13 '19 at 12:32
  • I tried what you said and I get `Missing write access to /Users/hasen/.nvm/versions/node/v11.13.0/lib/node_modules/n` not sure why that would be. – Hasen Aug 13 '19 at 12:34
  • 2
    Try using `sudo npm install -g n` – Onlinogame Aug 13 '19 at 12:36
  • Ok it worked with sudo but `node -v` is still showing v11.13.0 and I still get the same error with expo. Is it because I'm using nvm? Look at the edit in my question, the node that is being used is in the nvm folder. – Hasen Aug 13 '19 at 12:38
  • It probably is, check this https://stackoverflow.com/questions/34810526/how-to-properly-upgrade-node-using-nvm – Onlinogame Aug 13 '19 at 12:43
  • After `sudo n latest` it shows `installed : v12.8.0 to /usr/local/bin/node` and `active : v11.13.0 at /Users/hasen/.nvm/versions/node/v11.13.0/bin/node` – Hasen Aug 13 '19 at 12:44
  • @Onlinogame Sorry for the late reply but it took a billion years to install, but from that four year old thread, `nvm install node --reinstall-packages-from=$(nvm current)` worked for me. Post this as an answer and I'll accept it, thanks for your help. Really no idea why so many places say it's npm install latest to update node when in fact it's like you say, it's actually n latest... – Hasen Aug 13 '19 at 13:41

5 Answers5

52
nvm install node --reinstall-packages-from=$(nvm current)

if you're not using nvm :

sudo npm install -g n
sudo n latest
Onlinogame
  • 973
  • 6
  • 12
1

Did you install the nvm?

nvm document Github

If you did not install the nvm,

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash

And

Note: If the environment variable $XDG_CONFIG_HOME is present, it will place the nvm files there

export NVM_DIR="/Users/Chris/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

And

nvm install node

And

node --version
hong developer
  • 13,291
  • 4
  • 38
  • 68
1

I had this issue because brew was linked to node and nvm was not the only package manager.

brew unlink node.

1

Just Download the latest NodeJs Version and Install them.

link -: https://nodejs.org/en/download/

currently latest version 14.16.0. Expo works fine with this version.

1

I had installed the newer version of node using @Onlinogame's

sudo npm install -g n
sudo n latest

But it wasn't linked. Using sort of the opposite as @Morgan Peters,

brew link node

Fixed it.

bearacuda13
  • 1,779
  • 3
  • 24
  • 32