I have a ASP.NET 5 project in VS 2015. I'm setting up my gulp tasks and I am using the gulp-chmod module. This allows me to remove read only properties set by TFS in my copy processes. I've used v1.3 of this module sucessfully before in VS 2015 however the new version v2.0 has been upgraded to use ES 2015 features specifically:
note use of const
, let
'use strict';
const through = require('through2');
const deepAssign = require('deep-assign');
const Mode = require('stat-mode');
const defaultMode = 0o777 & (~process.umask());
function normalize(mode) {
let called = false;const through = require('through2');
const deepAssign = require('deep-assign');
...
I get the error:
cmd.exe /c gulp --tasks-simple
<MY_PATH>\node_modules\gulp-chmod\index.js:2
const through = require('through2');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (<MYPATH>\gulpfile.js:9:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
In the output from Task Runner explorer.
I have the latest version of Node.js installed and off the command line it all works well.
My node path is set to point to ./node_modules/.bin
I checked in the package manager console using node -v
and it appears I am using the latest node version.
So how do I control the Node version in use through task manager. I would like it to use ES2015 to compile my modules?
Thanks in advance
It sounds like you're running on an older version of Node.js.
I found this github ticket that suggests adding the following to your gulp script to show what version of node you're running under.
https://github.com/sindresorhus/gulp-imagemin/issues/178
console.log('Node version: ' + process.version);
You can go to Tools > Options > Projects and Solutions > External Web Tools
to find out where the version of node that VS is using resides.
This question has a fairly elegant solution of moving your "$(PATH)" entry to the top: Gulp task failing when run from VS 2015 Task Runner explorer, but not from command prompt