sh: symfony-cmd: command not found



我已经将Symfony 5.2应用模板降级为使用Symfony 4.4,以便允许使用一些需要旧版本Symfony的库。问题是,当我执行composer install时,我在安装结束时得到这个错误:

sh: symfony-cmd: command not found

看起来安装大部分是成功的,因为我的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"
}
}
}
}

对于那些已经安装了symfony/flex包并且仍然得到错误的人,请确保在运行composer时允许symfony/flex包执行代码。

这是因为自Composer 2.2.0以来,allow-plugins选项增加了一层安全性,允许您限制哪些Composer插件可以在启动时执行代码。

所以确保你在composer.json文件的allow-plugins配置中有合适的行

"config": { 
// other config...
"allow-plugins": {
"symfony/flex": true
}
},

symfony-cmd是Symfony Flex的一部分。您的composer.json不包含Flex的任何要求,所以运行composer require symfony/flex可能会解决这个问题。

虽然在项目中添加symfony/flex是一种解决方案,但请记住flex是可选的。如果你想在不安装Flex的情况下消除错误,只需从composer.json中删除symfony-cmd命令引用。

:

"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},

:后

"scripts": {
"auto-scripts": {},
"post-install-cmd": [],
"post-update-cmd": []
},

我遇到了一个特殊的情况,一个旧的部署脚本添加了--no-plugins到我的composer命令。删除它解决了我使用部署器v6的问题。

set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader');

显然你需要插件flex的工作,我假设,因为脚本块有一些命令,你也需要。所以没有脚本/插件会破坏你的安装。

相关内容

  • 没有找到相关文章

最新更新