App Entwicklung für Mobile, Web, Desktop

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

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

SyntaxError: Block-scoped declarations:

Fix:

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

Fix2:

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/<VERSION>/bin/node /usr/bin/node

(Use whatever the highest version is in place of „<VERSION>“ from your install options in /usr/local/n/versions/node.

Kommentar verfassen

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.