When using npm
in Visual Studio with NTVS, what are the options that are in effect? How do I apply --save
or -g
?
Will it corrupt the Visual Studio project in anyway if I were to run npm
outside of Visual Studio on the command line directly?
When using npm
in Visual Studio with NTVS, what are the options that are in effect? How do I apply --save
or -g
?
Will it corrupt the Visual Studio project in anyway if I were to run npm
outside of Visual Studio on the command line directly?
Copyright © 2021 Jogjafile Inc.
I can't say anything about ntvs, because I've never used it. But when we are talking about standard Package Manager Console Window:
there may be several installations of npm (and node.js) on your machine. Node.js installer stores its packages in "*C:\Program Files\nodejs*" path by default and sets up the system PATH variable with this value. When you install packages via -g option, they are stored in "%APPDATA%/npm" path.
So, when you use npm outside of Visual Studio, system console will apply to the version of npm/nodejs which is stored in the PATH variable.
To make sure that you use the same version of npm in Visual Studio, open Tools/Options => Projects and Solutions/External Web Tools option. Visual Studio will use locations of external tools by the order, as they are located in the list.
You can add PATH variable and put it in the first place to use the same version as you system.console does:
You can also check version of each npm installed on your machine. Just run "npm -v" in VS package manager console, and run it in your system console.
I have the same version for them because of my preferences:
But when I run this command opening cmd at $(VSINSTALLDIR)\Web\External path, I get an older version:
hope this helps =)