我已经将Symfony 5.2应用程序模板降级为使用Symfony 4.4,以便允许使用一些需要旧版本Symfony的库。问题是,当我执行composer install
时,在安装快结束时出现以下错误:
sh:符号命令:找不到命令
看起来安装大部分都是成功的,因为我的vendor
文件夹已经创建并填充了。但是我担心这个错误。
此错误是什么意思?如何修复?
====
编辑:这是我的composer.json
文件:
{
"type": "project",
"license": "proprietary",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.4.0",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"composer/package-versions-deprecated": "1.11.99.1",
"cweagans/composer-patches": "^1.7",
"doctrine/doctrine-bundle": "^2.4",
"doctrine/doctrine-migrations-bundle": "^3.1",
"doctrine/orm": "^2.9",
"phpdocumentor/reflection-docblock": "*",
"sensio/framework-extra-bundle": "*",
"symfony/framework-bundle": "4.4.*",
"symfony/http-client": "*",
"symfony/intl": "*",
"symfony/mailer": "*",
"symfony/mime": "*",
"symfony/monolog-bundle": "^3.1",
"symfony/notifier": "*",
"symfony/process": "*",
"symfony/property-access": "*",
"symfony/property-info": "*",
"symfony/proxy-manager-bridge": "*",
"symfony/security-bundle": "*",
"symfony/serializer": "*",
"symfony/string": "*",
"symfony/translation": "*",
"symfony/twig-bundle": "*",
"symfony/validator": "*",
"symfony/web-link": "*",
"symfony/yaml": "*",
"twig/extra-bundle": "*",
"twig/twig": "*"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4",
"roave/security-advisories": "dev-master",
"symfony/browser-kit": "*",
"symfony/css-selector": "*",
"symfony/debug-bundle": "*",
"symfony/maker-bundle": "*",
"symfony/phpunit-bridge": "*",
"symfony/stopwatch": "*",
"symfony/var-dumper": "*",
"symfony/web-profiler-bundle": "*",
"vimeo/psalm": "^4.9"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.2.*"
},
"patches": {
"symfony/maker-bundle": {
"Provide flag to force annotation in make entity command": "https://raw.githubusercontent.com/vklux/maker-bundle-force-annotation/master/maker-force-annotation-flag.patch"
}
}
}
}
4条答案
按热度按时间esbemjvw1#
对于那些已经安装了
symfony/flex
软件包但仍然收到错误的用户,请确保在运行composer时允许symfony/flex
软件包执行代码。这是因为从Composer 2.2.0开始,
allow-plugins
选项增加了一层安全性,允许您限制哪些Composer插件可以在启动时执行代码。因此,请确保在
composer.json
文件的allow-plugins
配置中有相应的行nimxete22#
symfony-cmd
是Symfony Flex的一部分。您的composer.json
不包含Flex的任何需求,因此执行composer require symfony/flex
可能会解决这个问题。krcsximq3#
虽然将symfony/flex添加到项目中是一种解决方案,但请记住Flex是可选的。如果您想在不安装Flex的情况下消除该错误,只需从composer.json中删除symfony-cmd命令引用即可。
之前:
之后:
e1xvtsh34#
我遇到了一个特殊的情况,一个旧的部署脚本添加了
--no-plugins
到我的composer命令中。删除它解决了我使用deployerv 6的问题。set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader');
显然你需要插件来运行flex,我想既然脚本块有一些命令你也需要,所以没有脚本/插件会破坏你的安装。