MopaBootstrapBundle Could not find composer.phar


MopaBootstrapBundle Could not find composer.phar

我正在尝试安装MopaBootstrapBundle,我用以下代码创建了一个视图:

{% extends 'MopaBootstrapBundle::base.html.twig' %}
{% block title %}Yourapp{% endblock %}
{# and define more blocks ... #}

但当我导航到该视图时,我会得到以下异常:

An exception has been thrown during the compilation of a template ("Unable to find file "@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-transition.js".") in "MopaBootstrapBundle::base.html.twig".

我相信这可能是由于无法安装较少,我得到以下错误:

C:'xampp'htdocs'Project>php app/console mopa:bootstrap:symlink:less
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.

  [RuntimeException]
  Could not find composer.phar

mopa:bootstrap:symlink:less [-f|--force] [-m|--manual] [--no-symlink] [pathToTwi
tterBootstrap] [pathToMopaBootstrapBundle]

即使我安装了composer,当我执行以下操作时它也能工作:

C:'xampp'htdocs'Project>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file.
Clearing the cache for the dev environment with debug true
Installing assets using the hard copy option
Installing assets for Symfony'Bundle'FrameworkBundle into web/bundles/framework
Installing assets for FL'FifaLeagueBundle into web/bundles/fifaleague
Installing assets for Mopa'Bundle'BootstrapBundle into web/bundles/mopabootstrap
Installing assets for Acme'DemoBundle into web/bundles/acmedemo
Installing assets for Sensio'Bundle'DistributionBundle into web/bundles/sensiodi
stribution
Checking Symlink ... OK

我的composer.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The '"Symfony Standard Edition'" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "jquery/jquery",
                "version": "1.9.1",
                "dist": {
                    "url": "http://code.jquery.com/jquery-1.9.1.js",
                    "type": "file"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "version": "master",
                "name": "twbs/bootstrap",
                "source": {
                    "url": "https://github.com/twbs/bootstrap.git",
                    "type": "git",
                    "reference": "master"
                },
                "dist": {
                    "url": "https://github.com/twbs/bootstrap/zipball/master",
                    "type": "zip"
                 }
            }
        }
    ],
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "doctrine/data-fixtures" : "dev-master",    
        "leafo/lessphp": "dev-master",
        "mopa/bootstrap-bundle": "dev-master",
        "twbs/bootstrap": "dev-master",
        "knplabs/knp-paginator-bundle": "dev-master",
        "knplabs/knp-menu": "2.0.*@dev",
        "knplabs/knp-menu-bundle": "dev-master",
        "craue/formflow-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev''ParameterHandler''ScriptHandler::buildParameters",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::buildBootstrap",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::clearCache",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installAssets",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installRequirementsFile",
            "Mopa''Bundle''BootstrapBundle''Composer''ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ],
        "post-update-cmd": [
            "Incenteev''ParameterHandler''ScriptHandler::buildParameters",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::buildBootstrap",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::clearCache",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installAssets",
            "Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installRequirementsFile",
            "Mopa''Bundle''BootstrapBundle''Composer''ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

好吧,如果您查看源代码,您会发现错误来自于库在您的系统中找不到它,特别是我假设这一行失败是因为windows没有which命令。

我猜解决方案是直接在项目目录中使用composer.phar文件。

如果你检查twbs/bootstrap捆绑包,你可能会发现它安装了transition.js和其他脚本,但moabootstrapbundle base.html.twig请求bootstrap-transition.js.如果是这种情况,我认为你将不得不重命名脚本或编辑base.html.twig。我安装了twitter/bootstrap,其中包含bootstrap-transition.js,所以我调整了符号链接。我不确定这个包到底给了我什么。