Configure Which NPM Is Used By Visual Studio's Task Runner Explorer?
In a usual Windows command line I see:
C:\Users\me\myProject\UI> node --version v8.12.0 C:\Users\me\myProject\UI> npm --version 6.11.3 C:\Users\me\myProject\UI> where node C:\Program Files\nodejs\node.exe C:\Users\me\myProject\UI> where npm C:\Program Files\nodejs\npm C:\Program Files\nodejs\npm.cmd C:\Users\me\AppData\Roaming\npm\npm C:\Users\me\AppData\Roaming\npm\npm.cmd
Now I am working with Visual Studio Professional 2017: If I open up a (Powershell) terminal via Tools > NuGet Packet Manager > Package Manager console, I see the global installation I favor:
PM> pwd Path ---- C:\myProject PM> Get-Command npm CommandType Name Version Source ----------- ---- ------- ------ Application npm.cmd 0.0.0.0 C:\Program Files\nodejs\npm.cmd PM> node --version v8.12.0 PM> npm --version 6.11.3 PM> Get-Command node CommandType Name Version Source ----------- ---- ------- ------ Application node.exe 18.104.22.168 C:\Program Files\nodejs\node.exe
However, if I choose
Defaults > version within the Task Runner Explorer, I see the following output:
C:\me\myProject> cmd.exe /c npm run version --color=always > [email protected] version C:\me\myProject > node --version v10.6.0
That's not the version I want, and neither any of the installations I saw in the command window in the beginning with
The only way that this is possible is that there is another installation somewhere which is chosen because of the PATH-settings within the Task Runner Explorer. Is that a correct conclusion? I want also the Task Runner Explorer to use the global installation, but how do I do that?
The issue is described at https://github.com/madskristensen/NpmTaskRunner/issues/66 as my colleague just told me. The solution is straight-forward, but only if you know where to look.
- Go to Tools > Options > Projects and Solutions > Web Package Management > External Web Tools
- In the appearing pop-up window, use the arrow-buttons to move the entry
$(PATH)to the 2nd position (it is probably further down in the list)
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error