Monday, 30 September 2019

Running ng build in gulp uses older version of node.js

I have a gulp script for building angular files with ng build. It works if I run it from command prompt, but fails when I run it from gulp with error:

You are running version v10.6.0 of Node.js, which is not supported by Angular CLI 8.0+.The official Node.js version that is supported is 10.9 or greater.Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.Process terminated with code 0.C:***> cmd.exe /c gulp -b "C:***" --color --gulpfile "C:***\Gulpfile.js" default

I have globally installed version of node v10.16.3, but it for some reason it says that I have v10.6.0. I am also using Gulp 4.

My gulp file looks like this:

var exec = require('child_process').exec;

gulp.task('buildNg', async function (cb) {
  exec('ng build', function (err, stdout, stderr) {
    console.log(stdout);
    console.log(stderr);
    cb(err);
  });
})

Does gulp use its own version of node.js? I don't see any other reason.



from Running ng build in gulp uses older version of node.js

No comments:

Post a Comment