Visual Studio 2015 RC Gulp task runner not detecting tasks

风格不统一 提交于 2019-12-21 06:57:29

问题


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.


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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




回答6:


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



来源:https://stackoverflow.com/questions/29963050/visual-studio-2015-rc-gulp-task-runner-not-detecting-tasks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!