srs / gradle-gulp-plugin

Gradle plugin for running Gulp tasks
70 stars 9 forks source link

Process 'command 'cmd'' finished with non-zero exit value 1 #10

Open HieronyM opened 9 years ago

HieronyM commented 9 years ago

Dear @srs,

Thanks for such a great plugin. But I am hitting the wall when using this plugin in my application.

Here the error when i run gradle build --info

Executing task ':gulp_build' (up-to-date check took 0.001 secs) due to:
  Task has not declared any outputs.
Starting process 'command 'cmd''. Working directory: C:\Users\intern\Desktop\Javascript\gulp-starter Command: cmd /c ""C:\Users\intern\Desktop\Javascript\gulp-starter\build\nodejs\node-v0.10.33-windows-x86\bin\node.exe" "C:\Users\intern\Desktop\Javascript\gulp-starter\node_modules\gulp\bin\gulp.js" "build""
Successfully started process 'command 'cmd''
[10:33:42] :gulp_build FAILED
:gulp_build (Thread[main,5,main]) completed. Took 4.0 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gulp_build'.
> Process 'command 'cmd'' finished with non-zero exit value 1

Here's my build.gradle file.

plugins {
    id "com.moowork.gulp" version "0.10"
    id "com.moowork.node" version "0.10"
}

apply plugin: 'com.moowork.gulp'
apply plugin: 'com.moowork.node'

node {
    version = '0.10.33'
    npmVersion = '2.1.14'
    download = true
    workDir = file("${project.buildDir}/nodejs")
}

task npmCacheConfig(type: NpmTask, dependsOn: npmSetup) {
    description = "Configure the NPM cache"
    def npmCacheDir = "${gradle.getGradleUserHomeDir()}/caches/npm"
    outputs.files file(npmCacheDir)
    args = [ 'config', 'set', 'cache', npmCacheDir ]
}

task npmPackages(type: NpmTask, dependsOn: npmCacheConfig) {
    description = "Install Node.js packages"
    args = [ 'install' ]
    inputs.files file('package.json')
    outputs.files file('node_modules')
}

ext.distFileName = 'umbrella-workshop.zip'
task zip(type: Zip) {
    from 'build', 'Dockerfile', 'nginx-default.conf', 'docker-compose.yml'
    include '**/*'
    exclude distFileName, 'nodejs'
    archiveName distFileName
    destinationDir new File(projectDir, 'build')
}

task clean(type: Delete) {
    delete 'build', 'report'
}

gulp_build.dependsOn npmInstall
task build (dependsOn: [gulp_build, zip])
zip.mustRunAfter gulp_build

Please help me figuring out what's wrong in my configuration. thanks.

srs commented 9 years ago

Hi.

I tested your code here (on my Mac) and it seems to be working. What's the Gradle version you are using? Do you have your "package.json" and "gulpfile.js" in place?

On Fri, Aug 14, 2015 at 5:38 AM, Hierony Manurung notifications@github.com wrote:

Dear @srs https://github.com/srs,

Thanks for such a great plugin. But I am hitting the wall when using this plugin in my application.

Here the error when i run gradle build --info

Executing task ':gulp_build' (up-to-date check took 0.001 secs) due to: Task has not declared any outputs.Starting process 'command 'cmd''. Working directory: C:\Users\intern\Desktop\Javascript\gulp-starter Command: cmd /c ""C:\Users\intern\Desktop\Javascript\gulp-starter\build\nodejs\node-v0.10.33-windows-x86\bin\node.exe" "C:\Users\intern\Desktop\Javascript\gulp-starter\node_modules\gulp\bin\gulp.js" "build""Successfully started process 'command 'cmd'' [10:33:42] :gulp_build FAILED :gulp_build (Thread[main,5,main]) completed. Took 4.0 secs. FAILURE: Build failed with an exception.

  • What went wrong:Execution failed for task ':gulp_build'.> Process 'command 'cmd'' finished with non-zero exit value 1

Here's my build.gradle file.

plugins { id "com.moowork.gulp" version "0.10" id "com.moowork.node" version "0.10" }

apply plugin: 'com.moowork.gulp' apply plugin: 'com.moowork.node'

node { version = '0.10.33' npmVersion = '2.1.14' download = true workDir = file("${project.buildDir}/nodejs") }

task npmCacheConfig(type: NpmTask, dependsOn: npmSetup) { description = "Configure the NPM cache" def npmCacheDir = "${gradle.getGradleUserHomeDir()}/caches/npm" outputs.files file(npmCacheDir) args = [ 'config', 'set', 'cache', npmCacheDir ] }

task npmPackages(type: NpmTask, dependsOn: npmCacheConfig) { description = "Install Node.js packages" args = [ 'install' ] inputs.files file('package.json') outputs.files file('node_modules') }

ext.distFileName = 'umbrella-workshop.zip' task zip(type: Zip) { from 'build', 'Dockerfile', 'nginx-default.conf', 'docker-compose.yml' include '*/' exclude distFileName, 'nodejs' archiveName distFileName destinationDir new File(projectDir, 'build') }

task clean(type: Delete) { delete 'build', 'report' }

gulp_build.dependsOn npmInstall task build (dependsOn: [gulp_build, zip]) zip.mustRunAfter gulp_build

Please help me figuring out what's wrong in my configuration. thanks.

— Reply to this email directly or view it on GitHub https://github.com/srs/gradle-gulp-plugin/issues/10.

Vennlig hilsen/Best regards

Sten Roger Sandvik Development Manager +47 95997084

The fastest way from idea to Digital Experience - http://youtu.be/cFfxuWUgcvI

HieronyM commented 9 years ago

dear @srs,

Gradle version 2.4. The package.json and gulpfile.js in place. Maybe some misconfiguration in package.json or gulpfile.js?

Here's my gulpfile.js

/*
  gulpfile.js
  ===========
  Rather than manage one giant configuration file responsible
  for creating multiple tasks, each task has been broken out into
  its own file in gulp/tasks. Any files in that directory get
  automatically required below.

  To add a new task, simply add a new task file that directory.
  gulp/tasks/default.js specifies the default set of tasks to run
  when you run `gulp`.
*/

var requireDir = require('require-dir');

// Require all tasks in gulp/tasks, including subfolders
requireDir('./gulp/tasks', { recurse: true });

and here for package.json:


{
  "name": "gulp-starter",
  "version": "0.1.1",
  "description": "Gulp starter with common tasks and scenarios",
  "repository": {
    "type": "git",
    "url": "git://github.com/greypants/gulp-starter.git"
  },
  "//": [
    "The following 'underscore' example demonstrates exposing a module included ",
    "by another module. If you were to npm install underscore separately and ",
    "require('underscore'), you'd end up with two copies in your bundle. The one",
    "you installed, and the one that shipped with another package (backbone in ",
    "this example). This is an edge case and should rarely happen.",
    "",
    "The 'plugin' example makes that file requireable with `require('plugin')`,",
    "and available to browserify-shim as 'plugin' on line 30."
  ],
  "browser": {
    "underscore": "backbone/node_modules/underscore",
    "plugin": "./src/javascript/vendor/jquery-plugin.js"
  },
  "browserify": {
    "transform": [
      "browserify-shim",
      "coffeeify",
      "hbsfy"
    ]
  },
  "browserify-shim": {
    "plugin": {
      "exports": "plugin",
      "depends": [
        "jquery:$"
      ]
    }
  },
  "devDependencies": {
    "browser-sync": "~2.2.2",
    "browserify": "^9.0.3",
    "browserify-shim": "^3.8.2",
    "coffeeify": "~1.0.0",
    "gulp": "^3.8.11",
    "gulp-autoprefixer": "^2.1.0",
    "gulp-changed": "^1.1.1",
    "gulp-filesize": "0.0.6",
    "gulp-iconfont": "^1.0.0",
    "gulp-imagemin": "^2.2.1",
    "gulp-minify-css": "~0.5.1",
    "gulp-notify": "^2.2.0",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "~1.3.3",
    "gulp-sourcemaps": "^1.5.0",
    "gulp-swig": "^0.7.4",
    "gulp-uglify": "^1.1.0",
    "gulp-util": "^3.0.4",
    "handlebars": "^3.0.0",
    "hbsfy": "~2.2.1",
    "karma": "^0.12.31",
    "karma-browserify": "^4.0.0",
    "karma-chrome-launcher": "^0.1.7",
    "karma-coffee-preprocessor": "^0.2.1",
    "karma-mocha": "^0.1.10",
    "karma-nyan-reporter": "0.0.51",
    "karma-sinon-chai": "^0.3.0",
    "lodash": "^3.3.1",
    "merge-stream": "^0.1.7",
    "pretty-hrtime": "~1.0.0",
    "require-dir": "^0.1.0",
    "vinyl-source-stream": "~1.0.0",
    "watchify": "^2.4.0"
  },
  "dependencies": {
    "backbone": "~1.1.2",
    "jquery": "~2.1.0"
  }
}

Thanks for your help.

mmayors commented 7 years ago

Hey everyone,

My team has hit this issue too. We also hit the same error when using plain old Gradle Exec to call npm. Has anyone else seen similar behavior?

hdaws commented 7 years ago

I just hit this issue myself. If there's an update i'd love to know it. We're using "gulp": "^3.9.1", and classpath "com.moowork.gradle:gradle-node-plugin:0.12" classpath "com.moowork.gradle:gradle-gulp-plugin:0.12"

hdaws commented 7 years ago

@mmayors I was able to solve this in my environment at least (untested with our full jenkins) by upgrading to this:

node version: 6.9.4 (latest our team has legal approval to use) gradle-node-plugin 1.0.1 gradle version - 2.4.4

I had to reconfigure my tasks to a degree - i removed the npm_install config I had and used this for node

node { // Version of node to use. version = '6.9.4' // If true, it will download node using above parameters. // If false, it will try to use globally installed node. download = true // Set the work directory for unpacking node workDir = file("${buildDir}/nodejs") // Set the work directory for NPM npmWorkDir = file("${project.buildDir}/npm")

distBaseUrl = '<my internal company repo here>'

}

I also went to using the built in gulp_build instead of gulpBuildWithOpts (which I could get away with).

I'm not sure the last bit is required but hopefully that helps.

I have a strong suspicion (but could be wrong) that the version of node/gradle plugin version, gulp version combination is what can result in the error we're seeing. (Priorly was running a very old node 0.12.4 and the 0.12 plugin version)

pavlovps commented 7 years ago

@mmayors Had the same issue with plain exec running gradle in TeamCity. Using local PowerShell all is fine however in TeamCity there is an issue.

Solved this using this method: def res = "tools/GitVersion/GitVersion.exe /output json".execute().text.trim() def versionObject = new JsonSlurper().parseText(res)

SatishYnbos commented 7 years ago

I am trying to create mongodb database using gradle task. And facing the following issue while running gradle create task.

$ gradle create --stacktrace :create MongoDB shell version v3.4.3 connecting to: mongodb://127.0.0.1:27017

exception: connect failed :create FAILED

FAILURE: Build failed with an exception.

And my build.gradle file as follows

task create(type: Exec) { workingDir 'mongdb installed dir' commandLine 'cmd' commandLine 'mongod' commandLine 'mongo' }

anat0lius commented 6 years ago
task simpleTask(type:Exec) {
    workingDir './scripts'
    commandLine 'cmd', '/c', 'myscript.bat'
}

If I run this task on my IDE or from command line, it works. But on Jenkins (with wrapped gradle), it fails:

A problem occurred starting process 'command 'cmd'

I noticed that if I comment out workingDir, I get the same error running from IDE/command.

solved: Actually the error was because it was unable to get the script, because it is on a submodule that I weren't initializing it.

benonymus commented 6 years ago

Hey I am getting this issue in android studio, when I am trying to build a signed apk

Amol-B-Patil commented 4 years ago

Hello Everyone..!!

If you are trying to build a react-native project with expo-kit ejected make sure you are running yarn start OR expo start in cmd in administrator privilege.

And then build your project.

It should definitely build..!!

Thanks in Advance..!

santosh90 commented 4 years ago

Hi, Here the error when i run gradlew dotcms:assets:npmInstall

FAILURE: Build failed with an exception.

Please find my gradle :

version = '0.1'

buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } }

dependencies {
    classpath "com.moowork.gradle:gradle-node-plugin:1.3.1"
    classpath 'com.moowork.gradle:gradle-gulp-plugin:0.13'
}

}

apply plugin: 'com.moowork.gulp'

node {

// Version of node to use.
//version = '4.4.4'
version = '10.15.1'

// Version of npm to use.
//npmVersion = '3.9.0'
npmVersion = '6.13.4'

download = true

}

gulp { colors = true bufferOutput = false }

task build(dependsOn: gulp_build) { description "Builds project running 'gulp build' command." }

task clean(dependsOn: gulp_clean) { description "Cleans project running 'gulp clean' command." }

task bundle(dependsOn: gulp_bundle) { description "Like build, but doesn't clean first" }

task 'test'(type: GulpTask) { description "Runs tests against project JavaScript" args = ["test"] project.addOptionalArguments(args); }

task 'build-send-watch'(type: GulpTask) { description "Runs gulp target ('build-send-watch') to build, send and watch resources for changes for automatic upload." args = ["build-send-watch"] project.addOptionalArguments(args); }

task 'bsw'(dependsOn: 'build-send-watch')

task 'watch' (type: GulpTask) { description "Runs a gulp watch to build and send and changed resources" args = ["watch"] project.addOptionalArguments(args); }

task 'build-send-everything'(type: GulpTask) { description "Runs gulp target ('build-send-everything') to build and send all resources (scripts, styles and assets)." args = ["build-send-everything"] project.addOptionalArguments(args); }

task 'send-everything'(type: GulpTask) { description "Runs gulp target ('send-everything') to send all resources (scripts, styles and assets)." args = ["send-everything"] project.addOptionalArguments(args); }

task 'send' (type: GulpTask) { description "Sends files if there are newer versions locally" args = ["send"] project.addOptionalArguments(args); }

def addOptionalArguments(args) {

def optionalArgumentNames = ["webdav_user", "webdav_password", "webdav_host", "webdav_port", "webdav_protocol"]

optionalArgumentNames.each {
    if (project.hasProperty(it)) {
        args.push("--$it=${project.property(it)}")
    }
}

}

and package.json

{ "name": "DotcmsSkeleton", "version": "1.0.0", "devDependencies": { "babelify": "10.0.0", "browserify": "16.5.0", "colors": "1.4.0", "del": "5.1.0", "event-stream": "4.0.1", "glob-all": "3.1.0", "gulp": "4.0.2", "gulp-autoprefixer": "7.0.1", "gulp-babel": "8.0.0", "gulp-browser": "3.0.11", "gulp-changed": "4.0.2", "gulp-concat": "2.6.1", "gulp-connect": "5.7.0", "gulp-debug": "4.0.0", "gulp-imagemin": "7.1.0", "gulp-jshint": "2.1.0", "gulp-livereload": "4.0.2", "gulp-load-plugins": "2.0.2", "gulp-minify-css": "1.2.4", "gulp-print": "5.0.2", "gulp-raster": "0.2.0", "gulp-rename": "2.0.0", "gulp-sass": "4.0.2", "gulp-shell": "0.7.1", "gulp-size": "3.0.0", "gulp-sourcemaps": "2.6.5", "gulp-sync": "0.1.4", "gulp-uglify": "3.0.2", "gulp-util": "3.0.8", "gulp-minify": "3.1.0", "gulp-webdav-sync": "2.0.3", "handlebars": "4.7.2", "imagemin-optipng": "7.1.0", "jasmine-ajax": "4.0.0", "jasmine-core": "3.5.0", "jasmine-jquery": "2.1.1", "karma": "4.4.1", "karma-browserify": "6.1.0", "karma-coverage": "2.0.1", "karma-jasmine": "3.1.0", "karma-phantomjs-launcher": "1.0.4", "lodash-compat": "3.10.2", "minimist": "1.2.0", "phantomjs": "2.1.7", "proxyquireify": "3.2.1", "underscore": "1.9.2", "vinyl-source-stream": "2.0.0", "vinyl-transform": "1.0.0", "watchify": "3.11.1", "yamljs": "0.3.0", "yargs": "15.1.0" }, "browserify": { "transform": [ "babelify" ] }, "dependencies": { "@babel/polyfill": "7.8.3", "@babel/preset-env": "7.8.3", "@informer/vue": "2.0.1", "angular": "1.7.9", "axios": "0.19.2", "bootstrap": "4.4.1", "bootstrap-select": "1.13.12", "browsernizr": "2.3.0", "classlist-polyfill": "1.2.0", "classlist.js": "1.1.20150312", "datatables.net": "1.10.20", "datatables.net-buttons": "1.6.1", "escape-string-regexp": "2.0.0", "file-saver": "2.0.2", "flexibility": "2.0.1", "highcharts": "8.0.0", "highcharts-vue": "1.3.5", "jquery": "3.4.1", "jquery-expander": "1.7.0", "js-polyfills": "0.1.42", "jszip": "3.2.2", "jszip-utils": "0.1.0", "moment": "2.24.0", "nodemailer": "6.4.2", "npm": "^6.13.6", "select2-browserify": "3.4.5", "twbs-pagination": "1.4.1", "vue": "2.6.11", "vue-resource": "1.5.1", "vue-router": "3.1.5", "webfontloader": "1.6.28", "zingchart": "2.8.8", "zingchart-angularjs": "1.2.0" } }

SherozeAli commented 4 years ago

Hey I am getting this issue in android studio, when I am trying to build a signed apk

same here ! any solution?

MiteshKalal7 commented 4 years ago

I got same error when try to build signed apk ./gradlew assembleRelease