升级到VS2018 15.8.1后Gulpfile.js无法加载

时间:2018-08-23 12:02:18

标签: gulp visual-studio-2017

升级到Visual Studio 2018 15.8.1(pro)后,我的Gulpfile.js无法加载。

我收到以下错误消息:

Failed to run "C:\...\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
gulp[37688]: src\node_contextify.cc:631: Assertion `args[1]->IsString()' failed.
 1: 00007FF6586E82F5 
 2: 00007FF6586C4156 
 3: 00007FF6586C4221 
 4: 00007FF65869A69A 
 5: 00007FF658CE5EB2 
 6: 00007FF658CE7008 
 7: 00007FF658CE636D 
 8: 00007FF658CE628B 
 9: 000002A6C5C041C1

即使最简单的Gulpfile.js也无法加载:

var gulp = require('gulp');
gulp.task('default', function () {
    // place code for your default task here
});

1 个答案:

答案 0 :(得分:4)

我的解决方法是:

  1. 首先,升级gulp软件包(在packages.json中):

    "gulp": "3.9.1" > "gulp": "4.0.0"
    "gulp-sass": "3.2.1" > "gulp-sass": "4.0.1"
    "gulp-uglify": "3.0.0" > "gulp-uglify": "3.0.1"
    "gulp-rename": "1.3.0" > "gulp-rename": "1.4.0"
    
  2. 第二,从“运行顺序”切换到gulp.series(请参见https://fettblog.eu/gulp-4-parallel-and-series/

  3. 最后,确保我的所有任务都表明任务已完成(请参见Gulp error: The following tasks did not complete: Did you forget to signal async completion?

VS社区有一些与解决方案相关的线程,都没有解决我的问题: