【问题标题】:how to install friendsofsymfony/user-bundle via composer?如何通过作曲家安装friendsofsymfony/user-bundle?
【发布时间】:2016-10-14 16:53:09
【问题描述】:

今天我开始使用 Symfony2 进行一些测试,但我不明白如何安装第 3 方包 friendsofsymfony/user-bundle

我已经安装了一个新的简单项目,名为“prova”

/public_html/prova
/public_html/prova/app
/public_html/prova/vendor
...

我已经安装了作曲家

/var/www/composer.phar
/var/www/public_html

阅读文档我应该使用下载包

./composer.phar require friendsofsymfony/user-bundle

下载所有包

/var/www/vendor

我的问题是 Composer 应该在我的项目 /var/www/public_html/prova/vendor 而不是 composer.phar 的位置上创建这个 /vendor 目录

应该如何在我的项目“Prova”中启用这个包?

更新 将 composer.phar 移到 public_html/prova 项目中并执行“require”命令但抛出此错误

[InvalidArgumentException]
The target directory "web" does not exist.

assets:install [--symlink] [--relative] [-h|--help] [-q|--quiet] [-  v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--] <command> [<target>]

Content-type: text/html

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets handling the symfony-scripts event terminated with an exception

Installation failed, reverting ./composer.json to its original content.

[RuntimeException]
An error occurred when executing the "'assets:install --symlink --relative
  '\''web'\'''" command:
Content-type: text/html

[InvalidArgumentException]
The target directory "web" does not exist.

  assets:install [--symlink] [--relative] [-h|--help] [-q|--quiet] [-v|v
  v|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction]
  [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--]
  32m<command> [<target>]
 .

【问题讨论】:

  • 你确定有web 文件夹吗? /var/www/public_html/prova/web ?

标签: symfony composer-php


【解决方案1】:

只需将composer.phar 复制到您的项目目录/public_html/prova 中并从那里执行:

php composer.phar require friendsofsymfony/user-bundle

否则,您可以全局安装 composer (https://getcomposer.org/doc/00-intro.md#globally) 并永远忘记 composer.phar 文件:

composer require friendsofsymfony/user-bundle

【讨论】:

    猜你喜欢
    • 2019-01-30
    • 2014-10-28
    • 1970-01-01
    • 1970-01-01
    • 2013-12-25
    • 2013-07-10
    • 1970-01-01
    • 2016-09-04
    • 2014-01-29
    相关资源
    最近更新 更多