Gitlab public runner赢得';不要跑鲍尔,因为跑在苏多

Gitlab public runner赢得';不要跑鲍尔,因为跑在苏多,gitlab,bower,gitlab-ci,bower-install,gitlab-ci-runner,Gitlab,Bower,Gitlab Ci,Bower Install,Gitlab Ci Runner,在没有sudo的情况下如何使用gitlab public runner运行bower命令 这是我的剧本 image: node:7 before_script: - npm install -g bower - bower install ... 这是我从测试中得到的结果 ... npm info ok $ bower install bower ESUDO Cannot be run with sudo Additional error details: Sinc

在没有sudo的情况下如何使用gitlab public runner运行bower命令

这是我的剧本

image: node:7
before_script:
  - npm install -g bower
  - bower install
...
这是我从测试中得到的结果

...
npm info ok 
$ bower install
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
ERROR: Build failed: exit code 1
谢谢。

您应该在bower命令后添加
--allow root


请参阅:

谢谢您的回答。它解决了问题,但是我可以在没有根的gitlab CI runner中运行bower吗?是的,当然可以。我没有足够的信息来说明它为什么尝试在这里使用sudo,但我看到您的
npm安装
使用了
-g
标志,这可能是它尝试以sudo的身份启动的原因。为什么需要在全球范围内安装bower?删除
-g
应该可以,并且不需要root。这是可能的,但在本地计算机中,我使用npm安装-g,可以毫无问题地运行bower。您尝试过吗?我不知道gitlab CI在内部做什么,我也不明白为什么您需要为CI在全局范围内安装bower。我没有尝试过,我更喜欢您的--allow root答案,它工作起来很有魅力。无论如何,谢谢你。