3

Info

  • I am using Visual Studio 2019.
  • The Microsoft guides for creating SPA's requires you to install NodeJS from the official website, at least the guides I have perused so far.
  • When I installed Visual Studio I selected NodeJS development.
  • Visual studio installed NodeJS here: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\NodeJs

Question
My goal is to use NodeJS for development and NOT interfere with the operation of Visual Studio AND to only have one version of NodeJS installed AND to avoid installing NVM.

  • Must I install NodeJS again or should I use the version installed by Visual Studio?

It also raises the following concerns, which I don't expect to get answered here, but it would be nice to know:

  • If I install it again, will conflicts occur between the two versions?
  • If conflicts occur, how do I resolve them?
  • If I use the one installed by Visual Studio, can I update it at will, or does Visual Studio require a specific version of NodeJS?

See also
Multiple versions of node on windows
Install different versions of NodeJS

GoWiser
  • 857
  • 6
  • 20

2 Answers2

4

There was a question posted to the Microsoft Developer Community forums that also addresses this question. Quote:

Thank you for reporting this feedback. The NodeJS workload doesn’t install the Node Runtime and NPM on it’s own. The install you mentioned in the Visual Studio folder is used internally for Visual Studio operations. You would need to install the runtime you want to use separately, which would be picked up by NodeJS workload and corresponding apps.

In response to your question:

Must I install NodeJS again or should I use the version installed by Visual Studio?

Yes - so while it seems a whole separate copy of Node.js and npm is installed under C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VisualStudio\NodeJs when you install Visual Studio (with the Node.js workload), you are meant to install the regular version of Node.js and npm from https://nodejs.org/ and use that in your day-to-day development activities, which is what I've been doing (except with VS2022) and have not encountered any conflicts so far.

Edit: IF you do encounter conflicts with installed Node.js or npm versions, there is a way to resolve them, by changing the order of precedance of paths that VS uses. Go to 'Tools -> Options -> CTRL+E: "External Web Tools"' and you should see this:

external web tools screenshot

Move the $(PATH) entry up or down depending on which version should take priority.

mamift
  • 651
  • 7
  • 18
-1

You can check if NodeJS is installed or not using the node -v and check if npm package manager is installed using npm -v. If you find that NodeJS is not installed, then download the NodeJS from here.

Aditya Joshi
  • 1,033
  • 7
  • 20
  • 1
    This assumes that npm is in my path, which it will be, if I add visual studio's install of NodeJS to my path. If you read my question, you will see that NodeJS **is** installed. I am not asking how to check if it is installed. – GoWiser Aug 28 '21 at 05:22