Visual Studio 2015 RC Gulp task runner not detecti

2020-06-30 09:12发布

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.

6条回答
走好不送
2楼-- · 2020-06-30 09:27

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.

查看更多
叛逆
3楼-- · 2020-06-30 09:40

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楼-- · 2020-06-30 09:41

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.

enter image description here

查看更多
Anthone
5楼-- · 2020-06-30 09:42

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楼-- · 2020-06-30 09:44

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

查看更多
叼着烟拽天下
7楼-- · 2020-06-30 09:47

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.

enter image description here

查看更多
登录 后发表回答