【发布时间】:2016-10-08 08:47:05
【问题描述】:
我正在尝试在 CENTOS 6.7 上使用 composer 安装 twig 时遇到此错误,我做错了什么?:
[root@mankomal /]# composer require twig/twig
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Using version ^1.24 for twig/twig
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installation failed, deleting ./composer.json.
[RuntimeException] //vendor does not exist and could not be created.
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress]
[--no-update] [--update-no-dev] [--update-with-dependencies]
[--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader]
[-a|--classmap-authoritative] [--] [<packages>]...
【问题讨论】:
-
看起来您正在从根目录 (
/) 执行命令,并且 composer 无法在那里创建 /vendor。您不应该从项目目录运行命令而不是从根目录执行命令吗? -
你可以使用 composer 作为 root,但你不应该。 Composer 管理本地库集,因此您不需要拥有超级用户权限。