Can't get gulp-phpcbf to work! Any help here would be greatly appreciated!
I AM able to run phpcbf from the terminal though with the following command:
$ (Project Folder) lib/vendor/composer/bin/phpcbf --standard="WordPress" src/test.php
Result:
Changing into directory /path/to/project/src
Processing test.php [PHP => 945 tokens in 193 lines]... DONE in 36ms (0 fixable violations)
No fixable errors were found
Time: 70ms; Memory: 5.75Mb
I have composer installed in my project directory in:
path/to/project/lib/vendor/composer
I'm also using gulp-phpcs and it seems to be working fine, I get an output of problems. I've also got the WP coding standards installed, although gulp-phpcbf fails with any standard.
PHP Codesniffer and the WP Standards seem to be installed fine, as they also work with gulp-phpcs. I'm on Ubuntu.
Here's my gulp task:
gulp.task( 'phpcbf', function() {
return gulp.src(['src/**/*.php'])
.pipe(plugins.phpcbf({
bin: 'lib/vendor/composer/bin/phpcbf',
standard: 'WordPress'
//warningSeverity: 0
}))
.pipe(gulp.dest(['src/']));
});
I get the following error:
events.js:141
throw er; // Unhandled 'error' event
^
Error: /bin/sh -c lib/vendor/composer/bin/phpcbf --standard="WordPress"
- Command failed: /bin/sh -c lib/vendor/composer/bin/phpcbf --standard="WordPress"
- child_process.js:203 ChildProcess.exithandler
child_process.js:203:12
- events.js:87 emitTwo
events.js:87:13
- events.js:172 ChildProcess.emit
events.js:172:7
- child_process.js:817 maybeClose
internal/child_process.js:817:16
- child_process.js:211 Process.ChildProcess._handle.onexit
internal/child_process.js:211:5
Some kind of permissions problem? Why can't gulp execute the phpcbf script?
Not sure where to go from here. Thanks for any help!