Gulp task failing when run from VS 2015 Task Runner explorer, but not from command prompt

前端 未结 2 1723
清歌不尽
清歌不尽 2020-12-03 08:09

I have some Gulp tasks to do the typical clean, build, release actions for a website. Nothing particularly unusual in my

相关标签:
2条回答
  • 2020-12-03 08:55

    See if you can print out the node version that Visual Studio is shelling out to. It is likely that the version of Node that Visual Studio is using is different than the one you are using at the console. The Map collection looks like it was introduced in Node v4.0.0 https://nodejs.org/en/blog/release/v4.0.0/

    You should be able to log the Node version using

    console.log('Version: ' + process.version);

    0 讨论(0)
  • 2020-12-03 08:57

    VS ships with an old version of Node.js and does not indicate whether an update will be coming any time soon, even with Update 2 coming out. Your system likely has a newer version. To fix this in Visual Studio, you need to prioritize your PATH (assuming you have node on your PATH). Simply find the "External Web Tools" option, and move $(PATH) to the top of the following...

    See this for more detail - Customize external web tools in Visual Studio 2015. Also, sorry for the picture, but it seems to be the most straightforward way to explain the issue.


    After seeing this answer grow in popularity to help others, I continued to dig into why this is still somehow an issue. I looked into the current Node.js Tools remarks for update 3 and still do not see any information regarding a version in their summary of updates as follows...

    • Faster, better ES6 IntelliSense
    • More reliable debugging
    • Improved Unit Testing experiences (including Tape support)
    • .npm command in more project types

    To go down the rabbit hole a little bit to see if their exact version choice is glaringly obvious (which it is not) I did find the following on their github repository...

    this.versions = {node: '0.10.0', v8: '3.14.5.8'};
    

    Could this be it? Unsure, but I'm thinking they're still not on board with shipping VS with newer versions of Node.js.

    0 讨论(0)
提交回复
热议问题