Gulpfile fails to run in VS 2019 - node.js. Error present in VS2019, not in 2017. Why? - node.js

loading my project in VS2019 i get the error as in the picture below.
Loading the project in VS 2017, i do not get this error.
Running the gulpfile manually, it is ok like this, proving that there is no error with the file:
Starting the project (Launching the local Web-server), the solution will run, and web-site start.
But the error is very annoying, how can i fix the error? It must be VS2019 configuration that is off/wrong somewhere?
Running gulp -v in the local repo:
And comparing with project package.sjon:
And in solution tree:
There is a difference, but that should be equal for VS2017...?
Or is there a conflict?
I have tried:
Adding a specific path: Task Runner Explorer window had "failed to load" under my Gulpfile.js and none of the build processes were listed
Installed gulp globally.

Updating gulp from 3.9.1 to 4.0.2 solved this for me. Dont know why VS-2019 would complain about this.
I had some bluescreens after a windows-update during (unsaved) work on this solution some days ago. So maybe some corruption of files etc...
Updateing in this context means
To uninstall 3.9.1
Install 4.0.2

Related

Visual Studio Installer is not installing 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.

Node Sass No Binding for Your current environment

I've seen quite a few of these questions on SO, but none seem to solve or match the problem.
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x. The odd thing is, I don't have Node.js 6.x installed. From the command line, node -v gives me v5.10.1.
I'm the Angular4 Universal Asp.net core visual studio 2017 template straight out of the box.
I've tried
npm rebuild node-sass --force
Reordering node in Web External toolsin Visual Studio
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HL4JSD9SSV8E": An unhandled exception was thrown by the application.
System.Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Module build failed: Error: Missing binding D:\Projects\angular2\node_modules\node-sass\vendor\win32-x64-48\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x
Found bindings for the following environments:
Windows 64-bit with Node.js 5.x
This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass --force to build the binding for your current environment.
at module.exports (D:\Projects\angular2\node_modules\node-sass\lib\binding.js:15:13)
at Object. (D:\Projects\angular2\node_modules\node-sass\lib\index.js:14:35)
Where have I gone wrong?
On Visual Studio 2017 (15.4.1) you should go to:
Tools > Configure External Tools > Projects and Solutions > Web Package Management > External Web Tools
Then reorder the tools as seen below.
This worked for me.
Deleting node_modules folder and re-installing npm modules using npm install worked for me.
Visual Studio ships it's own version of Node embedded so that's why you see a mismatch.
The TROUBLSHOOTING guide in the repo covers how to work around this https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#using-node-sass-with-visual-studio-2015-task-runner

NPM error (System.ComponentModel.Win32Exception) in Visual Studio 2015

I need to get started coding an Angular 2 application at my workplace but I get the following error in VS:
====Executing command 'npm install'====
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Microsoft.VisualStudioTools.Project.ProcessOutput..ctor(Process process, Redirector redirector)
Error executing npm - unable to start the npm process
Error - Cannot load global packages.
I've followed Angular 2 VS 2015 QuickStart guide, located here:
https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html
Prerequisites are all installed:
VS 2015 with Update 3
nodeJS v.6.9.1
TypeScript v.2.0.6.0
This error shows up in the output when I open the project or try to do a 'restore packages'
Thanks.
It looks like you need other version of Node. You have maybe too new version of Node I guess. According to this thread: https://github.com/Microsoft/nodejstools/issues/476
you should downgrade and configure VS:
It looks like vs2015 does not work with the latest 5.0.0 Node. Replacing with 4.2.2 one solves this issue for me. To make Visual Stuido use the same Node and npm as cmd by changing some files including node.exe under following folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External
Look for this article also http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/
I finally found out the reason.. nodeJS was installed with the x86 installer on a x64 computer. Installed nodeJS in 64 bit and it resolved my issue.
Hope this help anyone who has this error.

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/

Visual Studio build failure after adding com.phonegap.plugins.facebookconnect

I have reproduced this issue on both VS2013 & VS2015. Both are up to date with all the updates.
Steps to reproduce the problem:
Create a new Blank App (Apache Cordova) project.
Do a build and notice it all works fine.
Add this manually or by using the config tool.
Do a build and notice nothing happens. I get the error below.
I'm not sure why this is happening since no information is given to me in the error below. Any ideas on how I could get more details about the error? Or, has anyone come across this issue and fixed it? If so, how?
1>------ Build started: Project: Twelve, Configuration: Debug Android ------
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(96,5): warning : The TypeScript Compiler was given no files for compilation, so it will skip compiling.
1> GeneratedJavascript=
1> D:\Documents\Visual Studio 2013\Projects\Mobile\Twelve\Twelve>call "C:\Program Files (x86)\nodejs\"\nodevars.bat
1> Your environment has been set up for using Node.js 0.10.33 (ia32) and npm.
1> ------ Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\aulzf2r2.xwq\packages\vs-mda
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Sorry, I cannot add this as a comment but go to Tools > Options > Projects and Solutions > Build and Run and set MSBuild project build output verbosity to Detailed or Diagnostic. You should be able to see the error.
I have just installed the same plugin 0.11.0 and I am getting the following error.
3> TypeError: Cannot use 'in' operator to search for 'APP_ID' in undefined (TaskId:22)
3>Done executing task "MdaVsCli" -- FAILED. (TaskId:22)
3>Done building target "BuildMDA" in project "XXXX.jsproj" -- FAILED.: (TargetId:14)
I have the APP_ID defined as the plugin page mentions and configured it like it is mentioned on MSDN page for Manage Plugins for Apps Built with Visual Studio Tools for Apache Cordova but nothing seemed to help.
Still trying to find my problem out about it but I hope this helps with your problem.
Unfortunately, due to a Cordova issue, you can run into problems with plugin variables in Cordova < 5.0.0. Plugin variable information is lost if you install the "plugin" be fore the "platform" which can happen depending on your workflow. They do, however, function in Cordova 5.0.0 which you can use with VS 2015 RC. To update to 5.0.0 and use plugin variables, you will need to update your VS project and use the command line.
Remove the plugins with the variables via the config designer.
Update to Cordova 5.0.0 via the config designer (Platforms > Cordova CLI)
From the command line:
Go to your project directory.
Type the following substituting the plugin name for the plugin you wish to add:
npm install -g cordova
cordova plugin add nl.x-services.plugins.launchmyapp --variable URL_SCHEME=myscheme
This issue is actively being worked so things should improve in the future. You will also want to take note of the additional known issues pertaining to 5.0.0 when using it.
https://www.visualstudio.com/explore/cordova-known-issues-vs
You will also want to note the bug reported for the Facebook for the Cordova plugin registry when building for iOS. This will also likely cause issues with VS due to the NTFS file-system on Windows. Here's a possible fix for this problem:https://github.com/Chuxel/taco-tricks/tree/master/ios-plugin-symlink-fix

Resources