Azure DevOps gulp步骤失败,找不到本地模块 [英] Azure DevOps gulp step fails with Local modules not found

查看:62
本文介绍了Azure DevOps gulp步骤失败,找不到本地模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Azure DevOps构建步骤,可为angularjs应用程序运行gulp.我将Gulp文件路径设置为指向 GulpFile.js ,所引用的任务应捆绑该应用程序并将文件放入解决方案文件夹中的zip文件中.当我在Visual Studio中本地运行此程序时,效果很好.

I have a Azure DevOps build step that runs gulp for an angularjs application. I set the Gulp file path to point to the GulpFile.js the referenced task should bundle the app and put the files into a zip file in the solution folder. This works fine when I run this locally in Visual Studio.

在构建过程中出现的错误如下:

The error I am getting during the build is the following:

2019-07-08T15:54:56.5447810Z任务:Gulp2019-07-08T15:54:56.5447868Z说明:Node.js流任务基于基础的构建系统2019-07-08T15:54:56.5447921Z版本:0.141.22019-07-08T15:54:56.5447966Z作者:Microsoft Corporation2019-07-08T15:54:56.5448064Z帮助:更多信息2019-07-08T15:54:56.5448113Z============================================================================== 2019-07-08T15:54:57.7184034Z[命令] C:\ Users \ MYUSER \ AppData \ Roaming \ npm \ gulp.cmd导出--gulpfile C:\ a_work \ 15 \ s \ UI \ Gulpfile.js 2019-07-08T15:54:58.6597682Z [[90m15:54:58 [39m]在C:\ a_work \ 15 \ s中找不到本地模块\ UI2019-07-08T15:54:58.6597830Z [[90m15:54:58 [39m]尝试运行:npm安装

2019-07-08T15:54:56.5447810Z Task : Gulp 2019-07-08T15:54:56.5447868Z Description : Node.js streaming task based build system 2019-07-08T15:54:56.5447921Z Version : 0.141.2 2019-07-08T15:54:56.5447966Z Author : Microsoft Corporation 2019-07-08T15:54:56.5448064Z Help : More Information 2019-07-08T15:54:56.5448113Z ============================================================================== 2019-07-08T15:54:57.7184034Z [command]C:\Users\MYUSER\AppData\Roaming\npm\gulp.cmd Export --gulpfile C:\a_work\15\s\UI\Gulpfile.js 2019-07-08T15:54:58.6597682Z [[90m15:54:58[39m] Local modules not found in C:\a_work\15\s\UI 2019-07-08T15:54:58.6597830Z [[90m15:54:58[39m] Try running: npm install

是否发生此错误,因为Node缺少捆绑应用程序的必要模块.我可以在继续执行任务之前为应用程序进行捆绑任务调用npm install吗?

Does this error occur because Node is missing the necessary modules to bundle the app. Can I make the bundle task call npm install for the app before continueing the task?

推荐答案

您可以添加一个任务,只需在gulp构建之前执行 npm install 即可:

You can add a task just do the npm install before the gulp build:

steps:
- task: Npm@1
  displayName: 'npm install'
  inputs:
    command: install
    workingDir: '$(Build.SourcesDirectory)'
    verbose: false

这篇关于Azure DevOps gulp步骤失败,找不到本地模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆