madskristensen / NpmTaskRunner

Visual Studio extension
Other
88 stars 32 forks source link

NPM Task Runner - Fails to run script - Requires Latest npm - How to Update Npm #67

Closed tonyawad88 closed 5 years ago

tonyawad88 commented 5 years ago

Installed product versions

Description

It seems that the npm module that the Task Runner is using is completely independent of the npm module that is installed globally on the box. The reason why I am saying this, is that running an npm script using Task Runner produce an error

[12:08:42]  ionic-app-script task: "build" 
[12:08:42]  SyntaxError: Unexpected token { 
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)

however running the same command from powershell or cmd on Windows works great.

Is Task Runner using a different npm that the one installed globally on the machine? If so, can you help please with instructions on how to update npm for task runner?

Current behavior

Running a task from task runner that requires the latest version of NPM, failes to run the command successfully. However running the same command from command prompt directly works.

Expected behavior

package.json scripts should be run using the npm installed globally on the machine, or please provide a way to update npm that task runner is using.

Thank you!

scottaddie commented 5 years ago

@tonyawad88 See my comment here: https://github.com/madskristensen/NpmTaskRunner/issues/66#issuecomment-406308778

tonyawad88 commented 5 years ago

@scottaddie That works great. Thank you so much. Any idea why this is happening?

scottaddie commented 5 years ago

@tonyawad88 Visual Studio ships with its own versions of Node and npm, which you can find at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External. Unless you make the change described in my comment, those versions are used instead of what you installed yourself.