Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Task Runner Error with ES6

I am running Visual Studio 2017 and use the Task Runner to run tasks in my gulpfile. I recently updated a gulp task to ES6 and now am getting this error:

Failed to run "C:\Users\nz9rcn\Code\WebUI\Gulpfile.js"... cmd.exe /c gulp --tasks-simple C:\Users\nz9rcn\Code\WebUI\gulp-tasks\lesslint.js:5 let fail = false; ^^^ 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:404: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 task (C:\Users\nz9rcn\Code\WebUI\gulpfile.js:24:25) at Object.<anonymous> (C:\Users\nz9rcn\Code\WebUI\gulpfile.js:37:23) at Module._compile (module.js:397:26)

Can't find a place to adjust the settings causing this error (strict mode). Please help. Thanks

like image 359
Ben Rondeau Avatar asked Aug 09 '17 01:08

Ben Rondeau


1 Answers

Issue solved by un-checking the box for the Node.js binary used by Task Runner:

enter image description here

In the menu, go to Tools > Options > Projects and Solutions > Web Package Management > External Web Tools and DESELECT the option for $(VSINSTALLDIR)\Web\External

The version installed in that directory doesn't support ES6 apparently.

References for solution here and here.

like image 69
Ben Rondeau Avatar answered Oct 21 '22 03:10

Ben Rondeau