laravel-mix: SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
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)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 21
- Comments: 22 (2 by maintainers)
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 npmsudo npm install -g nsudo n stableThat 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/nodeUse whatever the highest version is in place of “<VERSION>” from your install options in /usr/local/n/versions/node.
Bump your Node dependency. You have 4.7.3, when the current version is 7.4.
This issue happened because of your NodeJS version. My working solution (for Ubuntu):
sudo rm -rf /usr/local/lib/node_modules/curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -sudo apt-get install -y nodejs@Mapamatician I installed NVM , followed the instructions in the usage section , and everything started working.
Followed @orrd instructions and it worked. For some people, node might be located at
/usr/local/bin/node, find out where your node is located by runningwhich nodePlease Update Node
Use n module from npm in order to upgrade node
sudo npm cache clean -f sudo npm install -g n sudo n stable To upgrade to latest version (and not current stable) version, you can use
sudo n latest
I use Bash on Windows (Ubuntu) and still got this error. Node version is 8.4.
@jhourlad Because you also need to run
sudo n stablewhich would actually download and create that folder with the updated version.@maitandat1507 your way works for me, saving my day!!
please post full command line by line. I got a lot error. sudo:n:command not found, /usr/bin/env: ‘node’: No such file or directory.
Thanks a lot… Save my day
@orrd Thank you SO MUCH, great man 👍 )
@matula Installing latest version of NVM worked. Thanks. 👍
Hi everyone, I have the same issue than @leegod but I had node before. What happened is that i tried to locate node with “which node” :
~$ which node /home/<my_user>/.nvm/versions/node/v8.9.4/bin/node
Then I used this with @orrd suggestion :
/.nvm/versions/node$ sudo ln -sf /.nvm/versions/node/v8.9.4/bin/node /usr/bin/node [sudo] password for <my_user>: /.nvm/versions/node$
And afterwards when I try to run my work I have now :
/usr/bin/env: ‘node’: No such file or directory
I’m still a newbie so I don’t really understand what happened but I think thatś what happened to @leegod
@leegod looks like you do not even have
nodeinstalled.@JeffreyWay Could you share the code to update the dependency please? Can’t seem to find what I’m looking for
http://stackoverflow.com/questions/42068686/laravel-mix-update-a-node-dependency
Edit: Installed Manually via https://nodejs.org/en/
However this actually downgraded npm from 4.4.5 to 4.1.2… Node was 2.15.5 now 7.5.0
had to also install a few modules like autoprefixer