I got an error while using constants inside my node js app. Here is the solution:

SyntaxError: Block-scoped declarations:

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


node -use_strict [to-be-replaced].js


Update your node version (node -v) to the current version or above 7.4

sudo npm install -g npm
sudo npm install -g n
sudo n stable

That still wasn't changing the version of Node that was being used. I finally found that you have change the /usr/bin/node symlink like this:

sudo ln -sf /usr/local/n/versions/node//bin/node /usr/bin/node

(Use whatever the highest version is in place of "" from your install options in /usr/local/n/versions/node.