Visual Studio Installer is not installing node.js - node.js

In Visual Studio Installer, I selected the Node.js development option. It runs successfully. But, if I try to run cmd node -v. It tells me node does not exist.
I tried a few other things including uninstalling and reinstalling the Node.js development option in VS Installer. Plus installing the latest version of node from the website.
However, when I try to run the pre-packed Angular solution that comes with VS 2017 I have issues. The solution will not even start.
The best I have been able to do is install Node 6.10.3. Once I do that, the web site comes up. But, I get a JavaScript error in the vendor.js file. I am able to continue but I get this error when I try navigate to another menu item. Plus the Hot Module Replacement does not seem to be working. (It does not automatically recompile my TypeScript file if I made a change).
I think the key is getting the Node.js development option installed correctly since I am able to run the pre-packed Angular solution on another PC and the Hot Module Replacement works fine.
Please let me know if anyone has any ideas on how to resolve.

I had a similar, if not the same, issue. Check the Visual Studio installation directory (2017 Professional in this case) for Node:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\NodeJs
If the executable is there, add the directory to your PATH.

Related

Must I install NodeJS when it is already installed by the Visual Studio Installer?

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
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:
Move the $(PATH) entry up or down depending on which version should take priority.
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.

"APK was defined multiple times" , app fails to install with Android Studio

My app was installing just fine... installing and reinstalling for testing, etc. But now it won't install anymore... and Android Studio says,
Application Installation Failed
Installation failed with message Failed to
finalize session :
INSTALL_FAILED_INVALID_APK: Split
lib_slice_3_apk was defined multiple times.
It is possible that this issue is resolved by
uninstalling an existing version of the apk if it is
present, and then re-installing.
WARNING: Uninstalling will remove the
application data!
Do you want to uninstall the existing
application?
[CANCEL] [OK]
I tried uninstalling the app from my phone, but it still won't re-install.
Also, I tried installing it fresh on an emulator where it had never been installed before, and that did not work either.
I suppose I must have inadvertently messed up some compile-related setting that I don't understand (but I haven't been doing anything like that). I don't have a knowledge of the compile process, and pretty much depend on Android Studio to do that.
I have been working on a "sister" app to this one... where I copied some libraries (.jar files such as zixng.jar from [project root]\app\libs) from this app to the other app. And that other app is installed on my phone also... but then again, it's not on the emulator... so I guess that's not the problem. Merp.
Thanks for any suggestions or possible explanations.
Try to clean & then Rebuild the project again. To do so please go to Build menu, both the tools are present their.
If issue not solved with that than try to invalidate caches & restart Android Studio from File menu -> Invalidate Caches/Restart.

Creating an Electron app using Visual Studio (not VSCode) w/ Node.js tools

I'm trying to use Visual Studio (not VSCode) to create a simple Electron app. I'm doing so via the Node.js tools for Visual Studio (v1.1) extension. I'm using the basic quick start app which works fine if I launch via npm start, but if I launch via Visual Studio, I get the following error on start up:
'Cannot find module 'electron' on the first line:
const electron = require('electron');
Can I tell Visual Studio to launch the Electron app first before starting it's node.js debugger? Has anyone else gotten this set up to work at all?
This is possible:
Create a blank Node.js JavaScript console app in Visual Studio. You need a recent version of node installed I think: I have 12.18.3. I'm using VS 2019 Community.
Add a dependencies section to the package.json that's created and reference electron. I referenced 11.0.1 as below:
"dependencies": { "electron": "11.0.1" },
This puts an entry in Solution Explorer under npm, so to actually
install it you can right-click/install npm package (or fire up a
command prompt and do npm install).
Copy the code from the electron-quick-start on GitHub: create index.html AND preload.js files in your Visual Studio project, and paste the code from GitHub into them. Also paste the quick start main.js contents into app.js. There's no need to rename it.
Go to properties of the console app project file. Where it says 'Node exe path:' put the path to electron.exe that was installed, which is in subfolder node_modules\electron\dist\electron.exe.
Put a breakpoint on the first line of createWindow in your app.js.
Start in debug. It should break at the breakpoint and if you continue it will show the basic electron app. This is an Electron window with a message in it: e.g. 'Hello World! We are using Node.js 12.18.3, Chromium 87.0.4280.60, and Electron 11.0.1.'
This is all well and good, but how useful it is depends on what you really want Visual Studio to do for you. It will only break on the main thread, although you can debug the renderer threads using the Chrome dev tools as usual. I find the node tools apps a little limiting. Maybe one of the other project types would be better.
This answer was updated November 2020, and previous answers removed. Note that as usual in npm world things do tend to break over time: please make a comment if things aren't working for you.

Installing nvm for windows : Visual Studio npm debug fails because of illegal characters in path

the newest node.js 0.12.0 doesnt work together with the sqlite3 package. i found nvm for windows: nvm for windows https://github.com/coreybutler/nvm-windows/releases . i thought nice to use the old and new node.js versions on 1 computer.
after installing nvm for windows in c:\nvm , i get in visual studio 2013 in debug that there is a fault in npm : illigal characters in path resulting in exit debug program . Outside Visual Studio it works fine.
As I mentioned in my comment, I had a very similar problem. After installing node.js for purpose of using gulp I could not do a successful build. I would get the following error:
C:\Visual Studio
Projects\MyProject\packages\RazorGenerator.MsBuild.2.2.6\build\RazorGenerator.Ms‌​Build.targets(21,9):
error : Illegal characters in path.
After searching around I guessed that the problem had to do with the node.js utilizing "illegally" long path names. For some background go here: https://github.com/joyent/node/issues/6960
My solution was to install the Flatten Packages tool: https://visualstudiogallery.msdn.microsoft.com/cd0b1938-4513-4e57-b9b7-c674b4a20e79?SRC=VSIDE
I ran flatten packages on the "node_modules" folder, tried to build (failed but with a different error), restarted Visual Studio, and everything now seems to build ok. Hope this helps.
UPDATE
One thing to keep in mind is that, by design, Flatten Packages will move files up in the directory structure. As a consequence, however, Visual Studio will still look for some of the folder/files in the OLD location; VS will shows the [!] symbol to show that the file was there but no longer is. These old file references can gum up the build, so you need to simply delete these old file references/directories.
Since this post still is on top when searching for this topic..
I also had this problem with "Illegal characters in path" and found that the best solution for me and my team was to make Visual Studio use the latest npm version (>= 3.0) since the node_modules folder depth doesnt get as deep as with npm2 (used by Visual Studio).
This solution will work for you in the background, not needing to run extra commands and tools for flattening the folder.
See my post here for a complete how to: http://newsweb.se/how-to-use-visual-studio-2015-with-latest-nodejs-npm/

Error: msvcp90.dll is missing on running an application built in visual C++

I have a project which I am trying to run (in both normal and debug modes) but every time I run it, it throws the error:
The program cannot start because MSVCP90.dll missing from your computer. Try re installing to fix your problem.
After going through lot of posts about the same problem I've tried the following things but nothing seems to work.
Found this .dll file in C:\Program Files\Microsoft Office Servers\15.0\Synchronization Service\Bin\Microsoft.VC90.CRT and copy pasted it in C:\Windows\System32\. Checked that the environmental variable path has system32 in it.
Checked in the project properties and have set the Embed Manifest option under Manifest Tool-> Input and Output as Yes for Debug as well as Release modes
The project I am building depends on 3 other projects (they are in same solution) and have set Embed Manifest as yes for all of them. Another .exe built for same project built on other machine runs perfectly fine on my machine but the one that I build on the same machine does not work.
Thanks in advance for your help.
Your best bet is to install the "official" Microsoft Redistributable on all target PCs that will run your app:
http://www.microsoft.com/en-us/download/details.aspx?id=11895

Resources