Visual Studio Bundled Node Js vs standard alone - node.js

I have installed Visual Studio 2015 and it comes with nodejs and npm now. Prior to installing Visual Studio i had installed a 64 bit Nodejs and this is up to date.
When I am trying to add gulp-less dependency to package.json file fails. Having a look at the Bower/NPM outputs I do see an Warning
npm WARN engine hawk#3.1.0: wanted: {"node":">=0.10.32"} (current: {"node":"v0.10.31","npm":"1.4.9"})
I suspect the issues is related to visual-studio being a 32 bit process it load a different version of Node and for unknown release ignores the 64 bit node js. This happens despite the fact I have $(path) varible before "$(DevEnvDir)\EXTENSIONS\MICROSOFT\WEB TOOLS\External" in External Web Tools.
So question is how do I update the Visual Studio version of Node.

Okay got my solution.
1- Removed NPM and node from system -> path
2- Open command prompt with Administrator priviledge and navigate to visual studio install directory
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External
3- run npm install -g npm
that fixes the problem, also remember to restart visual studio afterwards.

Related

Angular/Visual Studio: "ng is needed... npm is needed"

Using: Windows 10, Visual Studio 2022 17.1.0 (soon to be updated).
I come from the age when I would just copy the JavaScript files of a library in a subfolder of my website/application, add some <script...> tag to the adequate pages and call it installed...
But right now I'm trying to initiate my first Angular 2+ project. I'm trying to start from "Standalone TypeScript Angular Project" template.
But Visual Studio won't create my project, it writes in red
ng is needed (...)
npm is needed (...)
So I checked how to install ng... I needed npm, I checked how to install npm... I read it's recommended to install it through nvm... so I installed nmv, then npm, then ng ( v16.15.1 )... but Visual Studio still won't create my project and keeps requiring npm and ng.
What am I missing?
(I tried searching the Internet but mostly found a bunch of unrelated references and dead links.)
Here are the precise things I ran so far:
nvm-setup.exe
(I installed it in a custom folder of D:\ as I want this kind of tools to go there.)
nvm install lts
This installed npm in a subfolder of my customer folder.
npm install -g #angular/cli
This installed ng in a the same folder as npm + a subfolder.
I added '[...]/v16.15.1' (which contains npm.cmd, ng.cmd and node.exe) to the PATH "environment variable", but the problem remains unchanged.
Solved: after previous step, I needed to restart Visual Studio, but as I kept re-launching Visual Studio from Visual Studio Installer, it didn't work as a restart. Effectively closing the Installer and just relaunching Visual Studio refreshed things and it finally worked.
Solved: I needed to add the path that contains npm, ng and node to Windows "user and/or system Environment Variables".
And I also needed to restart Visual Studio (including closing Visual Studio Installer).

Update Node.js & Cordova in Visual Studio 2017

I'm trying to update nodejs and cordova.
In got the latest version of nodejs and installed it into c:\program files\nodejs
However there is some conflict when i try to install cordova
npm install -g cordova
Npm shows the version installed in visual studio and closes:
c:\ProgramData\Microsoft\VisualStudio\MDA\3614fb17\taco-toolset-6.3.1\node_modules
I tried most of the solution found on stackoverflow and many others on google nothing. manual change of the version in config.xml will simply crash the app and thats all.
How to update it?
Best solution as far.
I gave up on visual studio and using my good old Edit Plus IDE and using cordova in command line to build / run etc.

Visual Studio 2015 Node.js tools npm version

I would like to use the latest npm within Visual Studio 2015. I've installed Joyent Node from the Visual Studio installer. I understand one can install Node.js seperately but we seem to have issues with that so we are trying to do things the "Microsoft Way". I have also installed the Node.js Tools 1.1 for Visual Studio 2015. Within the node.js interactive window within Visual Studio, running .npm gives me the following:
Specify configs in the ini-formatted file:
C:\Users\MyUsername\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#2.7.4 C:\Program Files (x86)\nodejs\node_modules\npm
successfully completed
However, if I use the "Node.js command prompt" and run:
npm -g install npm
It updates npm and running npm command I get the following:
Specify configs in the ini-formatted file:
C:\Users\MyUsername\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#3.8.0 C:\Users\MyUsername\AppData\Roaming\npm\node_modules\npm
If I got back to Visual Studio 2015 Node.js Interactive Window and run .npm, I see the version hasn't changed, even with a VS restart. However, I had a long filename issue as reported by other users and not had the issue so I believe that npm 3.8.0 is actually being used but I can't be sure. How can I get Visual Studio 2015 to use the latest npm so I can avoid the long file name problem? Does the Node.js Interactive Window have any relevance here?
Thanks!
Go to Tools -> Options -> Projects and Solutions -> External Web Tools and add path to your node install. Then move it up in the list of dependencies.
Running npm-windows-upgrade within the Node.js command prompt and adding it with the path option with the path output in Visual Studio 2015 (above) fixed it for me.
http://www.triplet.fi/blog/npm-3-will-bring-brighter-future-for-windows-users/
https://github.com/felixrieseberg/npm-windows-upgrade

Problems running the ripple emulator on Visual Studio 2013

I am trying to run the ripple emulator on Visual Studio, however I cannot seem to get pass the cannot find module './lib/plugin'error as follows:
C:\Users[user name]\Documents\Visual Studio 2013\Projects\Cordova\Cordova>call "C:\Program Files (x86)\nodejs\"\nodevars.bat
Your environment has been set up for using Node.js 0.10.33 (ia32) and npm.
------ Ensuring correct global installation of package from source package directory: E:\PROGRAM FILES (X86)\VISUAL STUDIO\COMMON7\IDE\EXTENSIONS\FUBXMEK2.O2B\packages\vs-mda
1>MDAVSCLI : error : Cannot find module './lib/plugin'
PS: The previous error I got was cannot find module 'q' however this was resolved by running npm install from CLI.
I am trying to create a Cordova application using Visual Studio. Any ideas how I can resolve the above error?
It seems something went wrong while installing vs-mda, you can try following to re-install:
Close Visual Studio
Open cmd
npm install -g [path to vs-mda example C:\Users[user-name]\AppData\Roaming\npm\node_modules\vs-mda]
npm install -g [path to vs-mda-targets example C:\Users[user-name]\AppData\Roaming\npm\node_modules\vs-mda-targets]
OR
Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache
For the second method above (Clear Cordova Data) try running visual studio as administrator if it fails the first time around.

npm install for some packages (sqlite3, socket.io) fail with error MSB8020 on Windows 7

When trying to install some node.js packages (sqlite3 and socket.io in particular) using npm install socket.io on my Windows 7 machine with Visual Studio 2012 (and not 2010) I had some failures that looked like this:
C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(35,5):
error MSB8020: The builds tools for Visual Studio 2010 (Platform
Toolset = 'v100') cannot be found. To build using the v100 build
tools, either click the Project menu or right-click the solution, and
then select "Update VC++ Projects...". Install Visual Studio 2010 to
build using the Visual Studio 2010 build tools.
To get around this on my machine I did this command to install the package:
npm install socket.io --msvs_version=2012
I found the answer here when having the problem with installing sqlite3 and it worked with socket.io as well.
These might be more permanent solutions to fix the problem:
Install Visual Studio 2010
Updating the npm internal copy to a newer version of node-gyp as described here and here (probably the better option although I didn't get it working but didn't try for too long)
Another option is to change config instead of specifying msvs_version every time:
npm config set msvs_version 2012
I have both Visual Studio Express 2013 and Visual Studio Community 2015 installed.
I was getting
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...". [G:\work\cinema\node_modules\engine.io\node_modules\bufferutil\build\bufferutil.vcxproj]
The reason was that the latest Node.js for Windows downloaded from https://nodejs.org contains an old npm v2 (and old node-gyp inside that npm v2).
I had to update Node.js'es internal npm (which also updated node-gyp):
(open console as an administrator)
cd "C:\Program Files\nodejs"
npm install npm#latest
npm config set msvs_version 2013
Now it works (seems that it's using VS 2013 for the time being)
TL;DR
If you DON'T want node-gyp to depend on your installed version of Visual Studio (or don't have VS installed), install windows-build-tools (see below). This will eliminate both the error and should avoid future issues when upgrading your installed version of Visual Studio.
If you DO want node-gyp to depend on your installed version of Visual Studio, then npm config set msvs_version 2015, substitute your version tag in place of 2015. Valid versions tags are: 2015,2014,2013,110,100
Fixing using windows-build-tools
Per the node-gyp installation instructions, you can also do
npm install --global --production windows-build-tools from an ELEVATED command shell
This will install the strictly the Microsoft Visual C++ Build Tools (this will be used in place of Visual Studio for compilation) required by node-gyp, and appropriately set msvs_version to the version just installed.
After installing, you should check that the msvs_version set by windows-build-tools has not been overridden. When executing npm config list, msvs_version should appear under ; globalconfig C:\Users\Username\AppData\Roaming\npm\etc\npmrc; if it does not, the value set by windows-build-tools has been overridden and the overridden value should be deleted. npm config delete msvs_version should delete the overridden value and the one set by the build tools should appear under the global config section.

Resources