我正在运行Visual Studio 2017并使用Task Runner来运行我的任务gulpfile.我最近更新了一个gulp任务到ES6,现在我收到此错误:
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)
找不到调整导致此错误的设置的地方(严格模式).请帮忙.谢谢
使用Win10 Pro/VS2015和'网站'项目(不是asp.net,基本网站)
当尝试保存/重新加载gulpfile.js时,我收到错误消息(来自Task Runner Explorer /输出)
SyntaxError:在严格模式下使用const.
在目前的情况下,它正在窒息'gulp-changed'
我查看了可用的答案和评论:
在我的情况下,环境路径,$(PATH)已经包含节点的全局安装,但我需要将它移到$(DevEnvDir)路径之前,以便它将获得优先级.
(在提供正确答案后添加,谢谢@baao)