从root用户运行bower,这可能吗?怎么样? [英] Run bower from root user, it's possible? How?

查看:93
本文介绍了从root用户运行bower,这可能吗?怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地开发服务器,可以在其中测试很多东西,现在我正在玩凉亭,以管理Symfony2项目中库的依赖关系。安装NodeJS(v0.10.31)和bower(1.3.9)后,我尝试从控制台以<< c>形式运行属于Symfony2 SpBowerBundle的命令 sp:bower:install 。 code> root :

I have a local development server where I test a lot of things, now I'm playing with bower to manage the libraries' dependencies in my Symfony2 project. After getting NodeJS (v0.10.31) installed and bower (1.3.9), I tried to run the command sp:bower:install which belongs to Symfony2 SpBowerBundle from console as root:

Symfony > sp:bower:install
Installing bower dependencies for "TemplateBundle" into "/var/www/html/tanane/src/Tanane/TemplateBundle/Resources/config/bower/../../public/components"

bower ESUDO         Cannot be run with sudo

Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.

http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814

You can however run a command with sudo using --allow-root option

使用sudo运行命令我知道,添加-allow-root 可以正常工作,因为我直接从bash进行了测试,但是捆绑命令行显然不允许这样做。现在,这是将Bower作为 root 来添加-allow-root 的唯一方法,还是存在另一种方式?

I know that adding --allow-root works since I tested directly from bash but it apparently isn't allowed from the bundle command line. Now, is the only way to run bower as root to add --allow-root or does it exist another way ?

推荐答案

以下答案是针对symfony框架的捆绑包,
,但如果您来自Google strong>使用短语 bower root 可以解决以下问题:

below answer is for symfony framework's bundle, but if you come here from google using phrase "bower root" you have two options to solve that:


  1. add --allow- root to command

  2. 设置全局Bower配置,将允许
    以root身份运行Bower

选项1:,您可以通过输入以下内容以root用户身份运行bower:

Option 1: you can run bower as root by typing:

bower install --allow-root

通过设置--allow-root命令参数

root is allowed by setting --allow-root command parameter

选项2:通过创建文件使用允许root用户的全局设置:
/root/.bowerrc
其中具有以下配置:

Option 2: is using global setting that allows root, by creating file: /root/.bowerrc which have inside following configuration:

{ "allow_root": true }






如何在 SpBowerBundle symfony软件包中执行此操作:

可能您尚未在SpBowerBundle配置中将sp_bower.allow_root设置为true


how to do this in SpBowerBundle symfony bundle:
probably you haven't set sp_bower.allow_root to true in SpBowerBundle config

在捆绑包配置中,默认情况下,您需要设置以下内容:

in bundle config, by default you have set something like this:

allow_root: false # optional

,但是您应该:

allow_root: true

因此在app / config中/config.yml添加此捆绑包配置

so in app/config/config.yml add this bundle config

sp_bower:
    allow_root: false # optional



捆绑配置参考(所有设置):
https://github.com/Spea/SpBowerBundle/blob/master/Resources/doc/configuration_reference.md

这篇关于从root用户运行bower,这可能吗?怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆