2017-02-16 2 views
1

gitlab public runnerを使用してsudoなしでbowerコマンドを実行するにはどうすればよいですか?Gitlab public runnerはsudoで実行されているため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 

ありがとうございます。

答えて

2

bowerコマンドの後に--allow-rootを追加する必要があります。
参照:https://bower.io/docs/api/#allow-root

+0

回答ありがとうございます。それは問題を解決しますが、私は根なしでgitlab CIランナーでバワーを走らせることができますか? –

+1

はい、もちろん可能です。私はなぜここでsudoを使うのかというだけの十分な情報がありませんが、あなたの 'npm install'が' -g'フラグを使っているのが分かります。なぜあなたはグローバルにバワーを設置する必要がありますか? '-g'を削除すると動作し、rootを必要としません。 – CCH

+0

ローカルマシンではnpm install -gを使うことができますが、問題なくバワーを走らせることができます。 –

関連する問題