Visual Studio Task Runner“SyntaxError:在严格模式下使用const”。 [英] Visual Studio Task Runner "SyntaxError: Use of const in strict mode."
问题描述
使用Win10 Pro / VS2015与'网站'项目(不是asp.net,基本网站)
当试图保存/重新加载gulpfile.js时,我收到错误消息(来自Task Runner Explorer / output)
$ b
SyntaxError:在严格模式下使用const。
在目前的情况下,它正在扼杀'gulp-changed'
I已经浏览了可用的答案和评论:
在我的情况下,环境路径$(PATH)已经包含节点的全局安装,但我需要将它移动到$( DevEnvDir)路径,以便获得优先权。
(在提供正确答案后添加,谢谢@baao)
$ b $ VS似乎会安装(然后使用)一个旧版本的节点,这就是为什么任务运行者打破构建。 $ b$ b
转至工具>选项>项目和解决方案>外部Web工具
并将正确的路径添加到您的节点版本中(找到哪个节点
)的路径。
致谢: https://github.com/sindresorhus/gulp-imagemin/issues/178#issuecomment-218131138
Using Win10 Pro / VS2015 with a 'website' project (not asp.net, basic website)
When attempt to save/reload gulpfile.js I receive the error message (from Task Runner Explorer/output)
SyntaxError: Use of const in strict mode.
In the present case it is choking on 'gulp-changed'
I have looked through the answers and comments available:
- SyntaxError: Use of const in strict mode
SyntaxError: Use of const in strict mode?
- I have updated my version of node to the latest: 6.10.30
- I have cleaned the cache (npm cache clean -f)
- I have used 'which node' to determine that node is pointing to the installation of the latest install.
- "n" does not want to install on Windows (?)
In my case the environment path, $(PATH) already include the global install of node but I needed to move it ahead of the $(DevEnvDir) paths so that it would get priority.
(added after correct answer provided, thanks @baao)
VS seems to install (and then use) an old version of node, which is why the task runner is breaking the build.
Go to Tools > Options > Projects and Solutions > External Web Tools
and add the correct path to your node version (find the path with which node
).
Credits to: https://github.com/sindresorhus/gulp-imagemin/issues/178#issuecomment-218131138
这篇关于Visual Studio Task Runner“SyntaxError:在严格模式下使用const”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!