在Azure DevOps中运行gulpfile.js

时间:2019-10-11 09:27:03

标签: azure gulp

我有一个gulpfile.js,我想在Azure DevOps的构建过程中运行它。它可以在本地运行,但是它抱怨说天蓝色缺少模块。我的azure-pipelines.yml是从Azure DevOps中的向导生成的,看起来像这样:

trigger:
- feature/devops

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

- task: Npm@1
  displayName: 'Run npm install'
  inputs:
    command: install
    verbose: false
- task: Gulp@1
  inputs:
    gulpFile: 'gulpfile.js'
    targets: 'copyModuleDependencies moduleCopy'
    enableCodeCoverage: false

运行此构建会发生以下情况:

##[section]Starting: Gulp
==============================================================================
Task         : Gulp
Description  : Node.js streaming task based build system
Version      : 1.0.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613721)
==============================================================================
[command]/usr/local/bin/gulp copyModuleDependencies moduleCopy --gulpfile /home/vsts/work/1/s/gulpfile.js
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'upath'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/vsts/work/1/s/node_modules/chokidar/index.js:13:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
##[error]Gulp failed with error: /usr/local/bin/gulp failed with return code: 1
##[section]Finishing: Gulp

gulpfile.js位于我的项目结构的根部。

我该如何解决?

0 个答案:

没有答案