Open ttback opened 9 years ago
The same here. How we can fix this?
Remove the install
part, and run with composer:install
and it's fine with me.
If I try to grunt composer:install
I get following error:
$ grunt composer:install
Running "composer:install" (composer) task
Verifying property composer.install exists in config...ERROR
>> Unable to process task.
Warning: Required config property "composer.install" missing. Use --force to continue.
Aborted due to warnings.
Have you configured the path for composer
@phjun?
This is what I got
composer: {
options: {
usePhp: true,
phpArgs: {},
flags: ['no-dev'],
cwd: 'releases/tmp',
composerLocation: '/usr/local/bin/composer'
}
}
@ngocphamm I've installed composer globally, so it's also accessible via /usr/local/bin/composer
And that's my Gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
composer: {
options: {
usePhp: true,
copmposerLocation: '/usr/local/bin/composer'
},
update: {
options: {
composerLocation: '/usr/local/bin/composer update'
}
}
},
watch: {
scripts: {
files: 'composer.json',
tasks: ['composer:update:no-dev']
}
}
})
grunt.loadNpmTasks('grunt-composer');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['watch'])
}
I've defined an additional composer update task including the composer update command,.. in this way at least the grunt composer:update
command is working,... but I'm not sure if this is the right way!?
@phjun if you're still wondering about this, I had the same issue as you, so I did some trial and error as well as grepping the code and this is what I found (in Gruntfile.js):
composer: {
options: {
flags: ['no-dev'],
cwd: '<%= distPath %>'
}
},
If I run this with grunt -v composer:install
I get the same error as you:
Warning: Required config property "composer.install" missing. Use --force to continue.
I can add an install config property to the composer block:
composer: {
install: {
options: {
flags: ['no-dev'],
cwd: '<%= distPath %>'
}
}
},
But this gives me another error:
Running "composer:install" (composer) task
Verifying property composer.install exists in config...OK
File: [no files]
Options: flags=["no-dev"], cwd="dist/wp-social-streams"
Options: flags=["no-dev"], cwd="dist/wp-social-streams"
[InvalidArgumentException]
Command "undefined" is not defined.
Warning: Task "composer:install" failed. Use --force to continue.
However if I use another arbitrary option on the composer block:
composer: {
development: {
options: {
flags: ['no-dev'],
cwd: '<%= distPath %>'
}
}
},
grunt -v composer:development:install
Then it runs composer as it should.
If I want to define a custom location for composer.json and composer cli, I won't be able to just call grunt composer.install after having the custom config in grunt file: It will end up with
[InvalidArgumentException] Command "undefined" is not defined.