Search code examples
node.jscordovanpmgulpazure-devops

GULP Failed with error on VSTS?


While performing build on VSTS Gulp operation fails with an error:

"Gulp failed with error: C:\NPM\Modules\gulp.cmd failed with return code: 1"

I have configured my project on VSTS as you can see in the screenshot attached below along with the log file.

The following is the error log:

 2017-11-22T09:30:58.3245047Z ##[debug]Evaluating condition for step: 'gulp '
    2017-11-22T09:30:58.3245047Z ##[debug]Evaluating: succeeded()
    2017-11-22T09:30:58.3245047Z ##[debug]Evaluating succeeded:
    2017-11-22T09:30:58.3245047Z ##[debug]=> (Boolean) True
    2017-11-22T09:30:58.3245047Z ##[debug]Expanded: True
    2017-11-22T09:30:58.3245047Z ##[debug]Result: True
    2017-11-22T09:30:58.3245047Z ##[section]Starting: gulp 
    2017-11-22T09:30:58.3255058Z ==============================================================================
    2017-11-22T09:30:58.3255058Z Task         : Gulp
    2017-11-22T09:30:58.3255058Z Description  : Node.js streaming task based build system
    2017-11-22T09:30:58.3255058Z Version      : 0.5.31
    2017-11-22T09:30:58.3255058Z Author       : Microsoft Corporation
    2017-11-22T09:30:58.3255058Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613721)
    2017-11-22T09:30:58.3255058Z ==============================================================================
    2017-11-22T09:30:58.3265054Z ##[debug]tf vc resolvePath "$\VisitReport_Br\Client Components\Main\Source\vr20-11.1\vr20-11.1\gulpfile.js" /loginType:OAuth /login:.,******** /noprompt
    2017-11-22T09:30:58.8355028Z ##[debug]d:\a\3\s\gulpfile.js
    2017-11-22T09:30:58.8535002Z ##[debug]tf vc resolvePath "$\VisitReport_Br\Client Components\Main\Source\vr20-11.1\vr20-11.1" /loginType:OAuth /login:.,******** /noprompt
    2017-11-22T09:30:59.3974984Z ##[debug]d:\a\3\s
    2017-11-22T09:31:00.2756125Z ##[debug]agent.workFolder=d:\a
    2017-11-22T09:31:00.2796114Z ##[debug]loading inputs and endpoints
    2017-11-22T09:31:00.2806186Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
    2017-11-22T09:31:00.2826125Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
    2017-11-22T09:31:00.2826125Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
    2017-11-22T09:31:00.2836118Z ##[debug]loading INPUT_CWD
    2017-11-22T09:31:00.2836118Z ##[debug]loading INPUT_ENABLECODECOVERAGE
    2017-11-22T09:31:00.2836118Z ##[debug]loading INPUT_GULPFILE
    2017-11-22T09:31:00.2846108Z ##[debug]loading INPUT_GULPJS
    2017-11-22T09:31:00.2846108Z ##[debug]loading INPUT_PUBLISHJUNITRESULTS
    2017-11-22T09:31:00.2846108Z ##[debug]loading INPUT_TESTFILES
    2017-11-22T09:31:00.2846108Z ##[debug]loading INPUT_TESTFRAMEWORK
    2017-11-22T09:31:00.2856108Z ##[debug]loading INPUT_TESTRESULTSFILES
    2017-11-22T09:31:00.2856108Z ##[debug]loaded 11
    2017-11-22T09:31:00.2856108Z ##[debug]check path : d:\a\_tasks\Gulp_b82cfbe4-34f9-40f5-889e-c8842ca9dd9d\0.5.31\task.json
    2017-11-22T09:31:00.2866123Z ##[debug]set resource file to: d:\a\_tasks\Gulp_b82cfbe4-34f9-40f5-889e-c8842ca9dd9d\0.5.31\task.json
    2017-11-22T09:31:00.2866123Z ##[debug]system.culture=en-US
    2017-11-22T09:31:00.2916104Z ##[debug]gulpFile=d:\a\3\s\gulpfile.js
    2017-11-22T09:31:00.2926117Z ##[debug]check path : d:\a\3\s\gulpfile.js
    2017-11-22T09:31:00.2976112Z ##[debug]gulp=C:\NPM\Modules\gulp.cmd
    2017-11-22T09:31:00.2986113Z ##[debug]enableCodeCoverage=false
    2017-11-22T09:31:00.2986113Z ##[debug]publishJUnitResults=false
    2017-11-22T09:31:00.2986113Z ##[debug]testResultsFiles=d:\a\3\s\**\TEST-*.xml
    2017-11-22T09:31:00.2996115Z ##[debug]cwd=d:\a\3\s
    2017-11-22T09:31:00.3006117Z ##[debug]path exists: d:\a\3\s
    2017-11-22T09:31:00.3006117Z ##[debug]check path : C:\NPM\Modules\gulp.cmd
    2017-11-22T09:31:00.3026103Z ##[debug]targets=null
    2017-11-22T09:31:00.3026103Z ##[debug]C:\NPM\Modules\gulp.cmd arg: []
    2017-11-22T09:31:00.3026103Z ##[debug]C:\NPM\Modules\gulp.cmd arg: --gulpfile
    2017-11-22T09:31:00.3036112Z ##[debug]C:\NPM\Modules\gulp.cmd pathArg: d:\a\3\s\gulpfile.js
    2017-11-22T09:31:00.3036112Z ##[debug]C:\NPM\Modules\gulp.cmd arg: d:\a\3\s\gulpfile.js
    2017-11-22T09:31:00.3036112Z ##[debug]arguments=null
    2017-11-22T09:31:00.3046108Z ##[debug]exec tool: C:\NPM\Modules\gulp.cmd
    2017-11-22T09:31:00.3046108Z ##[debug]Arguments:
    2017-11-22T09:31:00.3046108Z ##[debug]   --gulpfile
    2017-11-22T09:31:00.3046108Z ##[debug]   d:\a\3\s\gulpfile.js
    2017-11-22T09:31:00.3046108Z [command]C:\NPM\Modules\gulp.cmd --gulpfile d:\a\3\s\gulpfile.js
    2017-11-22T09:31:02.0185156Z [09:31:02] Local gulp not found in d:\a\3\s
    2017-11-22T09:31:02.0185156Z [09:31:02] Try running: npm install gulp
    2017-11-22T09:31:02.0305468Z ##[debug]rc:1
    2017-11-22T09:31:02.0305468Z ##[debug]success:false
    2017-11-22T09:31:02.0365138Z ##[debug]taskRunner fail
    2017-11-22T09:31:02.0375154Z ##[debug]task result: Failed
    2017-11-22T09:31:02.0475149Z ##[error]Gulp failed with error: C:\NPM\Modules\gulp.cmd failed with return code: 1
    2017-11-22T09:31:02.0475149Z ##[debug]Processed: ##vso[task.issue type=error;]Gulp failed with error: C:\NPM\Modules\gulp.cmd failed with return code: 1
    2017-11-22T09:31:02.0545148Z ##[debug]Processed: ##vso[task.complete result=Failed;]Gulp failed with error: C:\NPM\Modules\gulp.cmd failed with return code: 1
    2017-11-22T09:31:02.0555145Z ##[section]Finishing: gulp 

The screenshot of the error is:

enter image description here

The contents of my package.json files are as follows:

"devDependencies": {
      "karma": "^0.13.0",
      "karma-jasmine": "^0.3.6",
      "karma-chrome-launcher": "^0.2.0",
      "gulp": "^3.9.0",
      "jasmine-core": "^2.8.0",
      "karma-edge-launcher": "^0.4.2"
    }

Solution

  • The reason is that you don’t install Gulp in the same folder of gulpfile.js. I think package.json file is not in the same folder of gulpfile.js file.

    Since the gulpfile.js file is in the source directory, you can add npm task (working folder: $(build.sourcesdirectory); npm command: install; arguments: gulp)