What is the newest version of Node supported by Ubuntu 16.04?

I need a version that allows ‘let’ declarations. Running with --harmony tags, “use strict” and everything else is still giving me the error:

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

I seem to be stuck with Node 4.2.6. Any work arounds?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


I generally recommend the repositories maintained by NodeSource. They’ve never failed me when I setup NodeJS for clients.


curl -sL | sudo -E bash - \
&& sudo apt-get install -y nodejs


curl -sL | sudo -E bash - \
&& sudo apt-get install -y nodejs


That being said, you need to remove any current versions before you install the above (ideally).

Hi @brendanokeefe96

You can install Node.js version 6 or 7 on Ubuntu 16.04 by following the official guide: Instead of doing the install again (the second line), you would update and upgrade:

sudo apt update && sudo apt dist-upgrade