Gulp 当 运行 来自 VS 2015 Task Runner 资源管理器时任务失败,但不是来自命令提示符
Gulp task failing when run from VS 2015 Task Runner explorer, but not from command prompt
我有一些 Gulp
任务来为网站执行典型的 clean
、build
、release
操作。在我看来没有什么特别不寻常的。 (事实上它与 Aurelia TypeScript 骨架非常相似。)
团队中的大多数人使用 Gulp
从 PowerShell / 命令提示符进行前端开发,并使用 VS Code / Sublime 进行编辑。一些团队使用 Visual Studio 2015 做同样的事情。
运行 命令提示符下的 build
任务工作正常,但如果我们 运行 它来自 Visual Studio 的任务运行器资源管理器,它给了我们一个错误。
但是,运行其他任务(例如 clean
)在命令提示符和 VS Task Runner Explorer 中工作得很好。
有趣的是,Task Runner 资源管理器甚至输出它为 运行 任务调用的进程的副本。如果我在命令提示符下复制那个确切的命令(见下文)和 运行,它会 not 给出错误。只有当 运行 来自 Task Runner Explorer 时才会发生,并且只有那个任务。
这是任务命令行和来自 Task Runner Explorer 的相关错误输出:
cmd.exe /c gulp -b "D:\Development\xxxx\WebSite" --color --gulpfile "D:\Development\xxxx\WebSite\Gulpfile.js" build
[20:40:42] Using gulpfile D:\Development\xxxx\WebSite\Gulpfile.js
[20:40:42] Starting 'build'...
[20:40:42] Starting 'clean'...
[20:40:42] Finished 'clean' after 5.74 ms
[20:40:42] Starting 'build-system'...
[20:40:42] Starting 'build-html'...
[20:40:42] Starting 'build-css'...
[20:40:42] Finished 'build-css' after 31 ms
[20:40:43] Finished 'build-html' after 162 ms
D:\Development\xxxx\WebSite\node_modules\gulp-tsb\lib\builder.js:153
var newLastBuildVersion = new Map();
^
ReferenceError: Map is not defined
at Object.build (D:\Development\xxxx\WebSite\node_modules\gulp-tsb\lib\builder.js:153:39)
at Stream.<anonymous> (D:\Development\xxxx\WebSite\node_modules\gulp-tsb\lib\index.js:40:22)
at _end (D:\Development\xxxx\WebSite\node_modules\through\index.js:65:9)
at Stream.stream.end (D:\Development\xxxx\WebSite\node_modules\through\index.js:74:5)
at DestroyableTransform.onend (D:\Development\xxxx\WebSite\node_modules\readable-stream\lib\_stream_readable.js:545:10)
at DestroyableTransform.g (events.js:180:16)
at DestroyableTransform.emit (events.js:117:20)
at endReadableNT (D:\Development\xxxx\WebSite\node_modules\readable-stream\lib\_stream_readable.js:960:12)
Process terminated with code 8.
at afterTick (D:\Development\xxxx\WebSite\node_modules\process-nextick-args\index.js:18:8)
at process._tickCallback (node.js:419:13)
我的 Google-Fu 在错误消息/堆栈跟踪或相关搜索中出现空。
什么给了?
更新:根据@josh-graham,下面列出了 VS 调用的节点版本。
[10:12:48] Starting 'clean'...
Version: v0.10.31
[10:12:48] Finished 'clean' after 42 ms
看看你是否可以打印出 Visual Studio 正在输出的节点版本。 Visual Studio 使用的 Node 版本可能与您在控制台使用的版本不同。 Map
集合看起来像是在 Node v4.0.0 https://nodejs.org/en/blog/release/v4.0.0/
中引入的
您应该能够使用
记录节点版本
console.log('Version: ' + process.version);
VS 附带旧版本的 Node.js,并且不表示更新是否会很快到来,即使 Update 2 coming out 也是如此。您的系统可能有更新的版本。要在 Visual Studio 中解决此问题,您需要优先考虑您的 PATH(假设您的 PATH 上有节点)。只需找到 "External Web Tools" 选项,并将 $(PATH) 移动到以下...
的顶部
有关详细信息,请参阅此处 - Customize external web tools in Visual Studio 2015。另外,对图片感到抱歉,但这似乎是解释问题的最直接方式。
看到这个答案越来越受欢迎以帮助他人后,我继续深入研究为什么这仍然是一个问题。我查看了当前 Node.js Tools remarks for update 3 和 仍然 在他们的更新摘要中没有看到任何关于版本的信息,如下所示...
- Faster, better ES6 IntelliSense
- More reliable debugging
- Improved Unit Testing experiences (including Tape support)
- .npm command in more project types
为了深入了解他们的确切版本选择是否非常明显(事实并非如此),我做了 find the following on their github repository...
this.versions = {node: '0.10.0', v8: '3.14.5.8'};
难道是这个?不确定,但我认为他们仍然不支持使用较新版本的 Node.js.
运送 VS
我有一些 Gulp
任务来为网站执行典型的 clean
、build
、release
操作。在我看来没有什么特别不寻常的。 (事实上它与 Aurelia TypeScript 骨架非常相似。)
团队中的大多数人使用 Gulp
从 PowerShell / 命令提示符进行前端开发,并使用 VS Code / Sublime 进行编辑。一些团队使用 Visual Studio 2015 做同样的事情。
运行 命令提示符下的 build
任务工作正常,但如果我们 运行 它来自 Visual Studio 的任务运行器资源管理器,它给了我们一个错误。
但是,运行其他任务(例如 clean
)在命令提示符和 VS Task Runner Explorer 中工作得很好。
有趣的是,Task Runner 资源管理器甚至输出它为 运行 任务调用的进程的副本。如果我在命令提示符下复制那个确切的命令(见下文)和 运行,它会 not 给出错误。只有当 运行 来自 Task Runner Explorer 时才会发生,并且只有那个任务。
这是任务命令行和来自 Task Runner Explorer 的相关错误输出:
cmd.exe /c gulp -b "D:\Development\xxxx\WebSite" --color --gulpfile "D:\Development\xxxx\WebSite\Gulpfile.js" build
[20:40:42] Using gulpfile D:\Development\xxxx\WebSite\Gulpfile.js
[20:40:42] Starting 'build'...
[20:40:42] Starting 'clean'...
[20:40:42] Finished 'clean' after 5.74 ms
[20:40:42] Starting 'build-system'...
[20:40:42] Starting 'build-html'...
[20:40:42] Starting 'build-css'...
[20:40:42] Finished 'build-css' after 31 ms
[20:40:43] Finished 'build-html' after 162 ms
D:\Development\xxxx\WebSite\node_modules\gulp-tsb\lib\builder.js:153
var newLastBuildVersion = new Map();
^
ReferenceError: Map is not defined
at Object.build (D:\Development\xxxx\WebSite\node_modules\gulp-tsb\lib\builder.js:153:39)
at Stream.<anonymous> (D:\Development\xxxx\WebSite\node_modules\gulp-tsb\lib\index.js:40:22)
at _end (D:\Development\xxxx\WebSite\node_modules\through\index.js:65:9)
at Stream.stream.end (D:\Development\xxxx\WebSite\node_modules\through\index.js:74:5)
at DestroyableTransform.onend (D:\Development\xxxx\WebSite\node_modules\readable-stream\lib\_stream_readable.js:545:10)
at DestroyableTransform.g (events.js:180:16)
at DestroyableTransform.emit (events.js:117:20)
at endReadableNT (D:\Development\xxxx\WebSite\node_modules\readable-stream\lib\_stream_readable.js:960:12)
Process terminated with code 8.
at afterTick (D:\Development\xxxx\WebSite\node_modules\process-nextick-args\index.js:18:8)
at process._tickCallback (node.js:419:13)
我的 Google-Fu 在错误消息/堆栈跟踪或相关搜索中出现空。
什么给了?
更新:根据@josh-graham,下面列出了 VS 调用的节点版本。
[10:12:48] Starting 'clean'...
Version: v0.10.31
[10:12:48] Finished 'clean' after 42 ms
看看你是否可以打印出 Visual Studio 正在输出的节点版本。 Visual Studio 使用的 Node 版本可能与您在控制台使用的版本不同。 Map
集合看起来像是在 Node v4.0.0 https://nodejs.org/en/blog/release/v4.0.0/
您应该能够使用
记录节点版本console.log('Version: ' + process.version);
VS 附带旧版本的 Node.js,并且不表示更新是否会很快到来,即使 Update 2 coming out 也是如此。您的系统可能有更新的版本。要在 Visual Studio 中解决此问题,您需要优先考虑您的 PATH(假设您的 PATH 上有节点)。只需找到 "External Web Tools" 选项,并将 $(PATH) 移动到以下...
的顶部有关详细信息,请参阅此处 - Customize external web tools in Visual Studio 2015。另外,对图片感到抱歉,但这似乎是解释问题的最直接方式。
看到这个答案越来越受欢迎以帮助他人后,我继续深入研究为什么这仍然是一个问题。我查看了当前 Node.js Tools remarks for update 3 和 仍然 在他们的更新摘要中没有看到任何关于版本的信息,如下所示...
- Faster, better ES6 IntelliSense
- More reliable debugging
- Improved Unit Testing experiences (including Tape support)
- .npm command in more project types
为了深入了解他们的确切版本选择是否非常明显(事实并非如此),我做了 find the following on their github repository...
this.versions = {node: '0.10.0', v8: '3.14.5.8'};
难道是这个?不确定,但我认为他们仍然不支持使用较新版本的 Node.js.
运送 VS