作曲家无法运行安装后脚本 [英] Composer unable to run post install script
本文介绍了作曲家无法运行安装后脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试在Composer安装/更新后的钩子中运行bash脚本时遇到以下错误:
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
原始composer.json
Works,但更新后安装/更新命令以在两个地方运行。
{
"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/",
...
...
]
}
}
根据作曲家文档:
脚本用Composer的术语来说,可以是PHP回调(将
定义为静态方法)或任何命令行可执行命令。
A script, in Composer's terms, can either be a PHP callback (defined as a static method) or any command-line executable command.
所以我的 composer.json
应该可以这样工作:
So my composer.json
should be able to work as such:
想要的作曲家。 json
{
"require": {
"twbs/bootstrap": "3.3.5"
...
...
},
"scripts": {
"post-install-cmd": [
"post-install.sh"
],
"post-update-cmd": [
"post-install.sh"
]
}
}
post-install.sh
每个人都可以执行( 0775
),并且与composer.json
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/
...
...
推荐答案
在评论中我建议使用
bash post-install.sh
这似乎可行。
这篇关于作曲家无法运行安装后脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文