question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Got this while trying to do a fresh install of Spark. Not sure if it’s a Spark or Mix issue. Thanks for any help!

node v4.7.3 npm 4.1.2 spark-installer 1.2.0 OSX 10.11.6

Would you like to compile your assets? (yes/no) [yes]:
 > yes

Running Build Script...

> @ dev /sites
> node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

/sites/node_modules/laravel-mix/setup/webpack.config.js:120
        let extractPlugin = new plugins.ExtractTextPlugin(
        ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at requireConfig (/sites/node_modules/webpack/bin/convert-argv.js:96:18)
    at /sites/node_modules/webpack/bin/convert-argv.js:109:17
    at Array.forEach (native)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:21
  • Comments:22 (2 by maintainers)

github_iconTop GitHub Comments

158reactions
orrdcommented, Jan 18, 2018

For anyone having this issue with Homestead or similar environments, I was unable to get Node to upgrade using the typical instructions which are usually

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.

64reactions
JeffreyWaycommented, Feb 1, 2017

Bump your Node dependency. You have 4.7.3, when the current version is 7.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Block-scoped declarations not yet supported outside strict mode
I've installed all the npm dependencies with npm install command. That didn't produce any errors. In my webpack.min.js file I have: const {...
Read more >
Block-scoped declarations (let, const, function, class) not yet ...
Error “Block-scoped declarations not yet supported outside strict mode” comes while you want to do build your app. It usually comes when you...
Read more >
Block-scoped declarations (let, const, function, class) not yet ...
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode #245.
Read more >
Uncaught SyntaxError: Block-scoped declarations (let, const ...
The reason is let keyword is not allowed in non-strict mode for this version of Chrome. The better solution is to add "use...
Read more >
Block-scoped declarations (let, const, function, class) not yet ...
JavaScript : Uncaught SyntaxError : Block - scoped declarations ( let, const, function, class ) not yet supported outside strict mode [ Gift ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found