I'm getting the following error when trying to run a bash script in Composer post install/update hooks:
> post-install.sh
sh: 1: post-install.sh: not found
Script post-install.sh handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output: sh: 1: post-install.sh: not found
Original composer.json
Works but it's just annoying to update the post install/update commands to run in two places.
{
"require": {
"twbs/bootstrap": "3.3.5"
...
...
},
"scripts": {
"post-install-cmd": [
"mkdir -p _libraries",
"cp -r vendor/twbs/bootstrap/dist _libraries/bootstrap/",
...
...
],
"post-update-cmd": [
"mkdir -p _libraries",
"cp -r vendor/twbs/bootstrap/dist _libraries/bootstrap/",
...
...
]
}
}
According to the Composer documentation:
A script, in Composer's terms, can either be a PHP callback (defined as a static method) or any command-line executable command.
So my composer.json should be able to work as such:
Wanted composer.json
{
"require": {
"twbs/bootstrap": "3.3.5"
...
...
},
"scripts": {
"post-install-cmd": [
"post-install.sh"
],
"post-update-cmd": [
"post-install.sh"
]
}
}
post-install.sh
Executable by everyone (0775) and located in the same directory as the composer.json
#!/bin/bash
mkdir -p _libraries
cp -r vendor/twbs/bootstrap/dist _libraries/bootstrap/
...
...
post-install.shexecutable? (e.g.chmod 0755 post-install.sh) You say it is, but I just thought I would confirm. Also, how is it being executed by Composer? It is calling it by somephpcall? - David C. Rankincomposer.pharandcomposer.jsonand defining the script underscriptsincomposer.json... - grimsh post-install.sh? However, I guess it should be evensh vendor/you/yourproject/post-install.sh. Have no test setup by the hand - hek2mgl