Visual Studio 2015 RC Gulp 任务运行器未检测到任务

Visual Studio 2015 RC Gulp task runner not detecting tasks

我在 Visual Studio 2015 RC 中有一个 Gulpfile.js,只有一个默认任务。由于某种原因,它没有出现在 Task Runner Explorer.

我已将 gulp 添加到 package.json 文件中的 devDependencies 并保存。

在候选发布版中,编辑 package.json 中的 devDependencies 然后保存不会导致包自动 restored/added 进入项目,正如我预期的那样。保存 package.json 后,包在解决方案资源管理器的依赖项节点中的 NPM 下列出,但包名称旁边带有标题 "not installed"。手动调用 Restore Packages,如屏幕截图所示,导致 Visual Studio 安装包。

安装节点模块后,Task Runner Explorer 检测到 gulp 任务。

我希望这对其他人有帮助。

我也遇到了同样的问题。将任务添加到 gulpfile.js 后重新启动 Visual Studio,我的问题就解决了。列出了所有任务。

对我来说,Visual Studio 在安装 npm 模块时崩溃并导致 npm 缓存损坏。

我不得不清理缓存,删除 node_modules,然后重新安装。

  • 关闭Visual Studio
  • 打开节点命令提示符
  • cd [PROJECT_DIR]
  • npm 缓存清理
  • 边缘node_modules
    • 当 windows 由于深度嵌套路径而失败时,这将删除 node_modules 文件夹
    • 要安装 rimraf:
    • npm 安装 rimraf -g
  • npm 安装

现在,打开 Visual Studio 它应该可以工作了。

从另一个 那里得到的关于 gulp 的答案,但这对我有用

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.

我遇到了同样的问题,但没有一个建议的方法适合我。 重新安装 NPM Task Runner 后问题消失了。 您可以从以下 link.

的市场下载最新的 NPM Task Runner

https://marketplace.visualstudio.com/items?itemName=MadsKristensen.NPMTaskRunner

这是一个老问题,但 VS 2017 用户可能会遇到同样的问题。

我在 VS 2017 中遇到了同样的问题,我错误地在子文件夹中添加了 gulpfile.js。

确保 gulpfile.js 在根文件夹中。 gulpfile should be in root folder