title: Executing gulp script in azure devops pipelines
body: <p>In my project I have a <code>gulpfile.js</code> which is supposed to copy some files from one directory to another one. Running this locally from <code>Task Runner Explorer</code> in Visual studio works. </p>
  
  <p>When I want to execute this gulp script in Azure DevOps, it complains about a missing package. </p>
  
  <p>My gulpfile.js looks like this:</p>
  
  <pre><code>/// &lt;binding AfterBuild='moduleCopy, copyModuleDependencies' /&gt;
  
  var gulp = require('gulp');
  var newer = require('gulp-newer');
  var rename = require('gulp-rename');
  
  
  gulp.task('copyModuleDependencies', function (cd) {
      gulp.src('../*Module/bin/Release/netcoreapp3.0/*.dll')
          .pipe(rename({ dirname: '' }))
          .pipe(gulp.dest("bin/Release/netcoreapp3.0/Modules"))
  });
  
  gulp.task('moduleCopy', function (cb) {
      gulp.src('../*Module/bin/Release/netcoreapp3.0/*.Module.dll')
          .pipe(newer("bin/Release/netcoreapp3.0/Modules/"))
          .pipe(rename({ dirname: '' }))
          .pipe(gulp.dest("bin/Release/netcoreapp3.0/Modules/"))
  });
  </code></pre>
  
  <p>My package.json file looks like this:</p>
  
  <pre><code>{
  
    "name": "MyHost",
    "version": "1.0.0",
    "description": "",
    "main": "gulpfile.js",
    "dependencies": {
      "gulp": "^4.0.2",
      "gulp-newer": "^1.4.0",
      "gulp-rename": "^1.4.0",
      "upath": "^1.2.0"
    },
    "devDependencies": {}
  }
  </code></pre>
  
  <p>And my azure-pipelines.yml file:</p>
  
  <p>trigger:
  - feature/obfuscated</p>
  
  <p>pool:
    vmImage: 'ubuntu-latest'</p>
  
  <pre><code>variables:
    buildConfiguration: 'Release'
  
  steps:
  - script: dotnet build --configuration $(buildConfiguration)
    displayName: 'dotnet build $(buildConfiguration)'
  - task: Npm@1
    inputs:
      command: 'install'
      workingDir: 'obfuscated.Host'
  - task: Gulp@1
    inputs:
      gulpFile: 'obfuscated.Host/gulpfile.js'
      targets: 'moduleCopy copyModuleDependencies'
      enableCodeCoverage: false
  </code></pre>
  
  <p>When triggering the build, it seems that npm is able to install the packages specified in the <code>package.json</code> file, but when it's supposed to execute the gulpfile.js this happens:</p>
  
  <p>internal/modules/cjs/loader.js:638
      throw err;
      ^</p>
  
  <pre><code>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.&lt;anonymous&gt; (/home/vsts/work/1/s/obfuscated.Host/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
  </code></pre>
  
  <p>Obviously it seems to be missing some packages from packages.json, but why does this work locally?</p>