sh:symfony-cmd:找不到命令

Posted

技术标签:

【中文标题】sh:symfony-cmd:找不到命令【英文标题】:sh: symfony-cmd: command not found 【发布时间】:2021-10-28 13:25:14 【问题描述】:

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

sh: symfony-cmd: 找不到命令

似乎安装大部分都成功了,因为我的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"
            
        
    

【问题讨论】:

【参考方案1】:

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

【讨论】:

虽然我遇到了composer require 的一些递归问题,但将这个要求添加到composer.json 文件就足以解决问题。谢谢!

以上是关于sh:symfony-cmd:找不到命令的主要内容,如果未能解决你的问题,请参考以下文章

sh:SET:在`npm start`中找不到命令

在 sh shell 中找不到源命令

sh:转换:在 spyder 上找不到命令

使用 sudo 时找不到命令

使用 sudo 时找不到命令

/bin/sh: pkg-config: 找不到命令