Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
777 views
in Technique[技术] by (71.8m points)

javascript - Visual Studio Task Runner "SyntaxError: Use of const in strict mode."

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:


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. 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)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...