Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task Runner Explorer can't load tasks

I'm using VS2015 and Gulp. I open the Task Runner Explorer and hit refresh, and this shows up in the log:

Failed to run "C:\Projects\Test\Gulpfile.js"... cmd.exe /c gulp --tasks-simple Error: `libsass` bindings not found in C:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-ia32-11\binding.node. Try reinstalling `node-sass`?     at Object.sass.getBinaryPath (C:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\lib\extensions.js:148:11)     at Object.<anonymous> (C:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:16:36)     at Module._compile (module.js:456:26)     at Object.Module._extensions..js (module.js:474:10)     at Module.load (module.js:356:32)     at Function.Module._load (module.js:312:12)     at Module.require (module.js:364:17)     at require (module.js:380:17)     at Object.<anonymous> (C:\Projects\Test\node_modules\gulp-sass\index.js:163:21)     at Module._compile (module.js:456:26) 

So I try to run cmd.exe /c gulp --tasks-simple in PowerShell, in the same directory, and it works fine - it returns a list of tasks.

I'm also able to run my SASS-related tasks just fine, so I'm not sure why this is complaining about SASS when it's being run via VS but not directly on the command line.

like image 288
Josh M. Avatar asked Jul 08 '15 19:07

Josh M.


People also ask

How do I use task runner Explorer?

Configuring Visual Studio Task Runner to Execute A Task When the Project is Opened. If you have never used or opened the built in task runner it is simple, press Alt + Shift + Backspace or select it from the other windows list from the View menu. You should see the task runner window at the bottom of Visual Studio.

How do I get a task runner in Visual Studio?

Setting up the Task Runner In Visual Studio 2019 (or 2022), confirm you are running the latest Node version. Download the latest version of Node and install it normally. In Visual Studio, go to Tools, Options. Expand the Projects and Solutions, Web Package Management, then External Web Tools.

What is NPM task runner?

The npm run command is powerful. It enables you to run any defined instructions living under the scripts key of your package. json file. These scripts have access to locally installed packages within your project, namely any CLI that is available for a package. Let's start with a very stripped down package file.

What is task runner in Visual Studio?

The Task Runner Explorer shows a list of available tasks and executing them is as simple as a click of the mouse. You can even bind any task to specific events that occur in Visual Studio such as Build, Clean and Project Open.


2 Answers

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
  • Reorder so that $(PATH) is above $(DevEnvDir)\Extensions\Microsoft\Web Tools\External

This also applies to other tools like Grunt, Bower and Gulp.

Found this solution by Mads Kristensen here.

For Visual Studio 2017, we can find the setting at
Tools > Options > Projects and Solutions > Web Package Management > External Web Tools

like image 112
M1Les Avatar answered Sep 17 '22 14:09

M1Les


It seems gulp-sass searchs node-sass in a different location. Here is a temporary solution.

  1. create a new directory named win32-ia32-11 inside c:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\vendor\

  2. Goto https://github.com/sass/node-sass-binaries and download win32-ia32-11_binding.node.

  3. Copy win32-ia32-11_binding.node file to c:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-ia32-11\ and rename it to binding.node

Visual Studio Gulp - Task Runner

like image 35
tansu Avatar answered Sep 18 '22 14:09

tansu