我正在使用VS2015和Gulp.我打开Task Runner Explorer并点击刷新,这显示在日志中:
Failed to run "C:\Projects\Test\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: `libsass` bindings not found in C:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-ia32-11\binding.node. Try reinstalling `node-sass`?
at Object.sass.getBinaryPath (C:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\lib\extensions.js:148:11)
at Object.<anonymous> (C:\Projects\Test\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:16:36)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Projects\Test\node_modules\gulp-sass\index.js:163:21)
at Module._compile (module.js:456:26)
Run Code Online (Sandbox Code Playgroud)
所以我尝试cmd.exe /c gulp --tasks-simple在PowerShell中运行,在同一目录中,它工作正常 - 它返回一个任务列表.
我也能很好地运行与SASS相关的任务,所以我不确定为什么在通过VS运行而不是直接在命令行上运行SASS时会抱怨它.
visual-studio gulp gulp-sass vs-2015-preview task-runner-explorer
我正在使用visual studio task runner(2015)在构建之前运行绑定到的Gulp任务.
我已经设置了它,以便当gulp任务失败时它会发送退出代码1,最后它会显示"使用代码1终止进程".然而,构建继续.
这将取消团队城市的构建,因此似乎是Visual Studio内部的Task Runner问题.
如果使用0以外的代码退出,我该如何防止构建?
我有一些Gulp工作做典型clean,build,release一个网站的行动.在我看来,没有什么特别不寻常的.(实际上它与Aurelia TypeScript骨架非常相似.)
大多数团队使用GulpPowerShell /命令提示符进行前端开发,并使用VS Code/Sublime进行编辑.一些团队使用Visual Studio 2015做同样的事情.
build从命令提示符运行任务工作正常,但如果我们从Visual Studio的Task Runner Explorer运行它,它会给我们一个错误.
但是,运行其他任务(例如clean)可以在命令提示符和VS Task Runner Explorer中正常工作.
有趣的是,Task Runner explorer甚至会输出它调用以运行任务的进程的副本.如果我复制确切的命令(见下文),并运行在命令提示符下,它并没有给出错误.它仅在从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] …Run Code Online (Sandbox Code Playgroud) javascript node.js gulp visual-studio-2015 task-runner-explorer
我是Webpack,Visual Studio和Task Runner的新手,但这些是我被告知要在工作中安装/使用的,所以我正在努力弄清楚如何使它全部工作.我刚刚使用NPM全局安装webpack和webpack-cli的新副本.我将Task Runner插件安装到Visual Studio,并使用提供的Run> Development选项.神秘的是,我的唯一机器出现以下错误,没有人知道原因:
C:\Users\[me]\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:3
let webpackCliInstalled = false;
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:429:10)
at startup (node.js:139:18)
at node.js:999:3
Process terminated with code 1.
Run Code Online (Sandbox Code Playgroud)
我正在使用最新版本的NodeJS和NPM.任何想法为什么未经修改的webpack下载会抛出块范围错误?
编辑:
我看到这个问题引起了一些关注,所以我想我应该提一下问题已经解决了.不幸的是,解决方案是完全卸载webpack和webpack-cli并重新安装它们.然后就行了.为什么...?谁知道?我听说其他人也遇到过这个问题,虽然我从第一次开始就没有复制过.
Task Runner Explorer只会在Visual Studio 2015 RC中为我抛出错误,我只是想禁用它并像我一样从命令行运行gulp文件.有没有办法关闭Task Runner Explorer?
我试图通过在任务运行器资源管理器中将watch的绑定属性设置为'After Build'来运行gulp watch.我尝试运行应用程序,在构建期间它从gulp触发我的监视任务并且它仍在运行.但我的应用程序没有在浏览器中运行,它只是挂在visual studio屏幕上.
在我停止监视任务后,我的项目运行,我可以在浏览器中看到我的应用程序.我注意到当你运行项目监视时,由一个线程触发,直到它被关闭,它不允许我的应用程序在浏览器中运行和打开.
我如何解决它.任何有用的帮助.
gulp.task('watch', ['compile', 'resources'], function () {
gulp.watch(["src/**/*", "!**/*.ts"], ['resources']);
gulp.watch("src/**/*.ts", ['compile']);
});
Run Code Online (Sandbox Code Playgroud)
以上是我的gulp手表,我将其设置为在构建任务运行器资源管理器后运行.
我正在使用TFS构建项目来构建一个Visual Studio 2015项目,该项目包含用于编译SASS的gulp文件.我试图了解使用MSBuild任务和任务运行器绑定的事件序列.似乎MSBuild知道足以检测并运行我的默认gulp任务BeforeBuild:
/// <binding BeforeBuild='default' />
var gulp = require('gulp');
var sass = require('gulp-sass');
var importer = require('sass-importer-npm');
gulp.task('sass', function () {
return gulp.src([
'./sass/**/*.scss',
'./node_modules/font-awesome/scss/**/*.scss'
])
.pipe(sass({ importer: importer }).on('error', sass.logError))
.pipe(gulp.dest('./Content/css'));
});
Run Code Online (Sandbox Code Playgroud)
我将使用MSBuild目标在BeforeBuild目标之后运行,以便我可以将生成的文件包含在项目中以供发布:
<Target Name="CopyGulpFiles" AfterTargets="BeforeBuild">
Run Code Online (Sandbox Code Playgroud)
这是我的构建.proj文件中的MSBuild调用,其中包含相关信息:
<ItemGroup>
<ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\MyProject.sln">
<AdditionalProperties>
VisualStudioVersion=$(VisualStudioVersion);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(StageFolder);
DeployOnBuild=false;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
</AdditionalProperties>
</ProjectsToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectsToBuild)" Properties="Configuration=Dev"/>
Run Code Online (Sandbox Code Playgroud)
每次运行它们时,这两件事似乎都以正确的顺序运行.这提出了一些问题:
我对npm创建的node_modules文件夹有问题.
指定的路径,文件名或两者都太长.完全限定的文件名必须少于260个字符,目录名必须少于248个字符.
一个解决方案是安装npm @ 3,因为它有--flat参数来展平文件夹.这很好.
现在我在VS2015中使用Task Runner Explorer.默认为npm安装没有"--flat"选项的模块.结果是我无法发布Web项目,因为路径超出了限制(即使将node_modules文件夹添加到项目文件中的ExcludeFoldersFromDeployment属性),错误消息是:
"CollectFilesinFolder"任务意外失败
一个解决方案是手动调用npm install --flat,但是我的同事会遇到同样的问题(我不是在谈论从文件系统中删除文件夹: - /).
有没有办法配置npm安装的参数,通过配置Taks Runner Explorer或者在package.json中?
我已经在我在VS2015社区制作的项目中应用了Gulp.但是当我使用Task Runner Explorer时,会出现一个对话框,说" 调用目标已抛出异常. "我尝试在"配置外部Web工具"中执行(PATH)操作,但它没有帮助所有.
NPM安装正在运行,Gulp正在正常执行.
我正在使用以下版本
此外,当我运行项目并打开任务运行程序资源管理器时,我有以下例外:
An exception was encountered while constructing the content of this frame. This information is also logged in "C:\Users\marvin\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml".
Exception details:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.TaskRunnerExplorer.TaskRunnerUserControl.InitializeControl(Object sender, EventArgs e)
at System.Windows.FrameworkElement.RaiseInitialized(EventPrivateKey key, EventArgs e)
at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
at System.Windows.FrameworkElement.TryFireInitialized()
at System.Windows.FrameworkElement.EndInit()
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object …Run Code Online (Sandbox Code Playgroud) 我有一个gulp任务,它使用yargs接受参数.从命令行我做了类似的事情gulp scaffold:thing --name=someName --path=some/path-to/{thing}.我希望能够调用它并提示用户输入所需的参数,这是否可以通过任务运行器?
我尝试过使用node的param库,但visual studio输出根本没有显示提示.
gulp ×7
node.js ×2
npm ×2
c# ×1
gulp-sass ×1
gulp-watch ×1
javascript ×1
msbuild ×1
webpack ×1