Visual Studio 2015 - Where's the gulp task runner? - gulp

I heard Mads Kristensen in his videos mention that Gulp and Grunt are both first class citizens. I thought I even heard mention of the Gulp task runner.
But when I create a gulpfile and right click there's no task runner.
Has anyone been able to get the "native" gulp task runner (if there is one) in Visual Studio 2015 Preview to appear?

View > Other Windows > Task Runner Explorer and click refresh
or just Ctrl + Alt + Bkspace

The Preview version of VS2015 requires Gulp to be installed globally and has a few other issues with auto-discovery of the gulpfile.js. These issues will all be addressed by the time VS2015 ships.

I had this same problem with VS2015 - TRX was showing "no tasks found" even though I had a valid, linted, gulpfile.js in the site root. I found the answer here: http://www.roelvanlisdonk.nl/?p=4258
Steps: Close VS. Open a cmd prompt from the site root and run npm install. Re-open VS and you should see your tasks in TRX. It worked for me.
EDIT: I had gulp installed globally but still encountered this "error." The above steps resolved the issue though.

Well I solved the problem with several restarts of VS2015. Finally the task runner appeared for my gulpfile. I still have no idea why it did not appear from the start but it's a preview version so maybe something is not quite right yet.

Barryman9000's answer helped me on the right track. I started with an empty ASP.NET 5 project in VS2015 and had no package.json file at the project root. Running npm install gave me an error message about missing package.json. After adding that file with the default dependencies from another ASP.NET 5 project, the Dependencies started downloading and my gulpfile tasks appeared in the Task Runner Explorer.

In your bash, go to the directory gulpfile.js is installed in and run:
npm install gulp
Why the downvotes? Please read the OP's question and the comments beneath it. Also, note that the answer with, currently, the most points has nothing to do with the question. Also please note that Mads Kristensen himself said that the issue was to install gulp.
Also, as for the commenter "Bonner" of this answer, note that Bash doesn't mean Linux. You can install git bash for Windows and run all of your NPM and Git commands there. Most developers I know use that bash on windows for all npm needs.
Lastly, if your Gulp Task Runner is not working, that is most likely because it is not recognizing your gulpfile. That is due to gulp not being installed. VS2015 didn't always install gulp for you. So the fix was to install gulp globally (As Mads Kristensen said), or directly where your gulpfile is. Also, restarting or re-installing VS sometimes kickstarted the gulp installation if you're lucky.
Conclusion: My answer is the correct answer. I reference the actual OP Question, comments beneath it, Mads Kristensen, and even the accepted answer. Yet, this answer is in the negative and some random answer about how to use the "View" menu in Visual Studio has 40 points.

Related

The target "ResolveTagHelperRazorGenerateInputs" does not exist in the project

I am getting the following error when i try to build an AspNetCore Web Application targeting netcoreapp2.2.
Error MSB4057 The target "ResolveTagHelperRazorGenerateInputs" does not exist in the project. C:\Program Files\dotnet\sdk\2.2.103\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets
I have tried the following:
clear cache on vs according to this post
update vs2017 to 15.9.5
reinstall net core sdks
reinstall vs
Nothing helped. I first got the error during an upgrade from core 2.1 to core 2.2 on a different project, and it's possible that by mistake edited the
Sdk.Razor.CurrentVersion.targets file. From that moment on, i keep getting this error on any project that targets core 2.2 (even new ones).
Does anyone encountered this problem or have any clues about solving it?
Thanks
After long battles it figured out to be a problem with VS NuGet Package Manager.
All I had to do was:
VS > Tools > Options > NuGet Package Manager > Clear All NuGet Cache(s).
The Following Link was my solution. I also struggled to get this fixed.
Just copy the files from the NetStandard2.0 folder from GitHub then replace it with you Directory from the same location.
Hopefully this helps someone.!
Here is the Answered Link:
https://social.msdn.microsoft.com/Forums/en-US/cafc9823-eb61-46f7-8489-007242ef2ad2/target-quotresolvetaghelperrazorgenerateinputsquot-does-not-exist-in-the-project?forum=msbuild
Here is the GitHub Link
https://github.com/aspnet/Razor/tree/master/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0
I encountered the same issue during the Azure build pipeline process, and clearing the NuGet package cache resolved the issue.
Solution:
I used a dotnet tasks with "custom" to issue the following command before NuGet package restore task:
command:
dotnet nuget locals global-packages -c
Screenshot shows the build pipeline task
For me the solution was as follows:
In Visual Studio
Right click on each project and click "Unload Project"
Right click on each project and click "Reload Project"

Gulp and Webpack does not show any info on console

I have a little trouble with my Gulp project.
Recently gulp sttoped to show practically any info about the buiding process(exept Browsersync messages). It looks like this now: Screen
I recently succesfully added Webpack to my project for processing Javasript, but it too works without any info.
I want it to look like this, as it were earlier: Good one
My system and soft info:
Windows 10 x64
Node v6.9.3
NPM 4.0.5
Gulp 3.9.1
I will be grateful for any help.
After long debugging i found, that Gulplog Plugin caused problems. After deleting it all things starts working

Angular 2 RC5 webpack source maps misaligned for debugging

Since upgrading to RC5, when debugging in Chrome dev tools, breakpoints are hit, but the debugger identifies the line as several to many lines later (in this case 15 lines!). In the screenshot the "current" line is actually the line where debugger; is present. This is making debugging very difficult. This is in combination with webpack. It works, but you have to interpret things manually rather than seeing exactly which line is executing. It appears to only do this on my ts files, not on the angular code if I debug into it.
I'd love ideas on the source of this problem and how to fix it.
Chrome 52
webpack 1.13.1 with config.devtool = "source-map"
If you set config.devtool to eval all is correct. But any other value seems to have the offset issue.
Angular 2 RC5
I was facing the same problem. The solution that was given to me was to uninstall the npm version of the angular-cli and reinstall the Github one by running the following:
npm uninstall --save-dev angular-cli
and then
npm i --save-dev github:angular/angular-cli#a8d7c0a9a0c1657db2a673c42bfbaa51fde2a466

How do I use electron-compile?

I'm having trouble with electron-compile.
The docs state
How does it work? (Easiest Way)
Change your reference to electron-prebuilt to electron-prebuilt-compile. Tada! You did it.
What reference, where? You can't be talking about package.json?
I've always run electron using supervisor -x "electron" -i "./" .
What am I completely missing / what should be the contents of my pull request to make this clearer?
I've installed electron-compile with npm i electron-compile --save-dev
I'd like to have es2015/jsx precompiled to es5, so that I can run a react application in electron. electron-compile appears to solve this problem.
You should install Electron as a dev reference in package.json, yes:
npm install --save-dev electron-prebuilt-compile
Don't install Electron as a global because then other people have to set stuff up to run your app (i.e. they now have to micromanage which version of Electron they have installed globally)
With the recent versions (electron 1.3.5), I was unable to get electron-prebuilt-compile working, well it works for development but packaging for production has no real working examples.
It seems the compiling and packaging needs to be done manually, so in case anyone needs a working example, it's here. Hope to save someone some time and pain.

Visual Studio 2015 RC Gulp task runner not detecting tasks

I have a Gulpfile.js in Visual Studio 2015 RC with a single default task. For some reason it is not showing up in the Task Runner Explorer.
I had added gulp to the devDependencies in my package.json file and saved it.
I was also facing the same issue. Just restarted Visual Studio after adding the tasks to gulpfile.js and my problem was solved. All tasks were listed.
In the release candidate, editing the devDependencies in package.json and then saving does not result in the packages being automatically restored/added to the project as I had expected. After saving package.json the packages were listed under NPM in the Dependencies node in Solution explorer, but with a caption "not installed" next to the package names. Manually invoking Restore Packages, as shown in the screenshot, causes Visual Studio to install the pacakges.
After the node modules had been installed the gulp tasks were detected by the Task Runner Explorer.
I hope this helps someone else.
For me, Visual Studio crashed while installing the npm modules and it caused corruption in the npm cache.
I had to clean the cache, delete node_modules, and install again.
Close Visual Studio
Open node command prompt
cd [PROJECT_DIR]
npm cache clean
rimraf node_modules
This will delete the node_modules folder when windows fails because of deep nested paths
To install rimraf:
npm install rimraf -g
npm install
Now, open Visual Studio and it should work.
Answer taken from another question about gulp, but this worked for me
I had the same problem migrating from VS2013 recently. As Josh noted in his comment here Visual Studio 2015 ships with an older version of node. In case you don't want to get stuck with whatever version of node is built into Visual Studio, you can tell it to use the version you have already installed. Go to Tools > Options > Projects and Solutions > External Web Tools and reorder locations so that $(PATH) is above $(DevEnvDir)\Extensions\Microsoft\Web Tools\External. This also applies to other tools like Grunt, Bower and Gulp.
This is old question but same issue could be faced by VS 2017 users.
I was facing same issue in VS 2017 and mistakenly, I had added gulpfile.js in the sub folder.
Make sure gulpfile.js is in the root folder.
gulpfile should be in root folder
I had the same problem and no-one of suggested method works for me.
After re-installing NPM Task Runner the problem gone away.
You can download latest NPM Task Runner from marketplace in following link.
https://marketplace.visualstudio.com/items?itemName=MadsKristensen.NPMTaskRunner