JavaScript (Client/Server), nodeJS

SyntaxError: Use of const in strict mode

I’m working with node.js, and in one of my js files I’m using const in "strict mode". When trying to run it, I’m getting an error:

SyntaxError: Use of const in strict mode.

If this is happening in nodejs, it is due to the older version of nodejs. Update node by using,

1) Clear NPM’s cache:

sudo npm cache clean -f

2) Install a little helper called ‘n’

sudo npm install -g n

3) Install latest stable NodeJS version

sudo n stable

Update nodejs instructions taken from,


You Might Also Like