Bower: invalid option: --allow-root - ruby-on-rails

I'm having this issue on ubuntu 14.04LTS:
When I do rake bower:install:dev I get:
Error: EACCES, permission denied
'home/MyName/.config/configstore/bower-github.yml' You don't have access to this
file.
When I do sudo rake bower:install:dev I get:
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
When I do sudo rake bower:install:dev --allow-root I get:
invalid option: --allow-root
How do I solve this issue?

I solved it by adding .bowerrc file in the root of my app with the following content:
{ "allow_root": true }

Related

How do I remove Permission denied # rb_sysopen - Gem install error?

I am trying to install create a new app in Ruby on Rails and I cannot get passed this error:
$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/pg-0.21.0/.gemtest
Its a permissions issue. You could fix it with this:
sudo chown -R $(whoami) /Library/Ruby/Gems/*
or possibly in your case
sudo chown -R $(whoami) /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/*
What does this do:
This is telling the system to change the files to change the ownership to the current user. Something must have gotten messed up when something got installed. Usually this is because there are multiple accounts or users are using sudo to install when they should not always have to.
It's likely there's a permissions problem somewhere along the .rbenv path. You might try turning on write privileges for your user with:
$ chmod -R +w ~/.rbenv
That will recursively (-R) change the file mode (chmod) to write permission (+w) for all files and directories under your user's .rbenv path. There's no particular reason for not having files set to write.
For Mac M1 systems try,
Allowing full disk access to terminal.
Apple->systemPreferences->Security&Privacy->privacy(Tab)->'+' button, check in Terminal application.
Then Restart terminal
2.Try using,
sudo chflags noschg
Delete the pod folder, reinstall it again. If it doesn't work use this command:
sudo pod install --allow-root
It really doesn't matter on mac how you configure your eyaml create the dir and config manually, add some public key location to it, and its works just fine after adding full disk access to the terminal as Kewin suggested ^ ^. Thumbs up.
No need to change permission, just export GEM_HOME:
export GEM_HOME="$HOME/.gem"
please run:
sudo gem install pg

rbenv Permission denied with Assetic on Ubuntu

I struggled for hours trying to have Assetic with Sass and Compass working on my production server.
The error is:
sh: 1: /root/.rbenv/shims/ruby: Permission denied
This is because my rbenv instalation is under the /root directory so Assetic doesn't have the permision to use it.
I've checked similar issues:
"Rbenv permission denied issue"
"rbenv: Permission Denied"
"Should rbenv be installed system-wide, or at a user level?"
but they didn't help.
I'm using Apache so I guess the default user is "www-data".
As explained in one of the above questions, I tried to grant www-data the permission in /root but either this didn't work or I did it wrong.
sudo chown -R www-data ~/.rbenv
This is the complete error:
[exception] 500 | Internal Server Error | Assetic\Exception\FilterException
[message] An error occurred while running:
'/root/.rbenv/shims/ruby' '/usr/local/bin/compass' 'compile' '/var/www/myapp/app/cache/dev' '--boring' '--images-dir' '/var/www/myapp/app/../web/uploads/img' '--config' '/var/www/myapp/app/cache/dev/assetic_compassu3IAzJ' '--sass-dir' '' '--css-dir' '' '/var/www/formation-hero/app/cache/dev/assetic_compassPbwM3H.scss'
Error Output:
sh: 1: /root/.rbenv/shims/ruby: Permission denied
I'm using Apache on Ubuntu 14.04
# which ruby
/root/.rbenv/shims/ruby
# which compass
/usr/local/bin/compass
# which rbenv
/root/.rbenv/bin/rbenv
# rbenv -v
rbenv 1.0.0-14-gc388331
Symfony 2.7 is installed under /var/www/myapp/
What should I do to either give right to Apache to use the /root repository or, maybe better, how do I install rbenv for my Symfony2 project?
Everything is working fine on my localhost with OS X.
I do not have experience with the said components but assuming that the user who is executing the file is www-data it might be an issue with the permissions of the /root/.rbend/shims/ruby file.
Run the command sudo chmod o+x /root/.rbenv/shims/ruby wich will give execute permissions to the owner of the file, presumably www-data since you ran the chown command.
If it still doesn't work run the command ls -l /root/.rbenv/shims/ruby, the 4th character of the first column should be x, indicating the owner has execution permissions.
For more info on linux file permissions check "Understanding and Using File Permissions".

luarocks install fails?

I install torch following
http://torch.ch/docs/getting-started.html
But when I use luarocks to install libs, like itorch, I command
luarocks install itorch
gives
Error: Your user does not have write permissions in
/home/myname/code/torch/install/lib/luarocks/rocks
-- you may want to run as a privileged user or use your local tree with --local.
Then I cmd
sudo luarocks install itorch
gives
sudo: luarocks: command not found
Then I cmd
luarocks
gives
Configuration files:
System: /home/myname/code/torch/install/etc/luarocks/config.lua (ok)
User : /home/myname/.luarocks/config.lua (not found)
Rocks trees in use:
/home/myname/.luarocks
/home/myname/code/torch/install
So is it installed successfully ?
The first error message explains the problem: your user doesn't have write permission to the directory where you installed Torch. This is probably because you ran something as root that you shouldn't have.
You can probably fix this by running something like:
sudo chown -R myname: /home/myname/code/torch/install/lib/luarocks
sudo chmod -R u+w /home/myname/code/torch/install/lib/luarocks

unable to connect to chromedriver http://127.0.0.1:9515 (Selenium::WebDriver::Error::WebDriverError)

I have installed chrome-driver from http://chromedriver.storage.googleapis.com/index.html
and I have installed both Google-chrome browser also.
I want to Run cucumber test cases using chrome browser instead of Firefox browser but I am stuck with this error.
Any help appreciated.
Thanks
I had this issue because of path override with rbenv shim.
It's worth checking where which chromedriver points too.
For me the fix was:
gem uninstall chromedriver-helper and brew install chromedriver
If you using rbenv on linux machine then
copy 'chromedriver' to current using ruby versions like below -
cp chromedriver $HOME/.rbenv/versions/2.2.0/bin
Example: cp chromedriver home/abc_user/.rbenv/versions/2.2.0/bin
and then set the permissions like -
chmod +x home/abc_user/.rbenv/versions/2.2.0/bin/chromedriver
Open Terminal:
brew link --overwrite chromedriver
I have encountered after installation of ansicon1.60 for colourful screen. After uninstalling it by the following command in ansicon directory:
C:\Users\Administrator\Downloads\x64>ansicon.exe -i
after that, i decided not to use ansicon.
If you have rbenv concerns problem, you may try:
$ rbenv rehash
and then run your test again. ;)
ChromeDriver setup in Linux [Ubuntu]
Open Terminal and download Chromedriver using the cmd
$ wget http://chromedriver.storage.googleapis.com/2.7/chromedriver_linux64.zip
$ Unzip chromedriver_linux64.zip
$ cp chromedriver /usr/local/bin
$ chmod +x /usr/local/bin/chromedriver
Do not use ansicon1.60 for colourful screen.
Run cmd /d which starts the command prompt without processing its AutoRun entry, thus bypassing ANSICON. Then you should just be able to do \x64\ansicon -u.

"bad interpreter: Permission denied " error while trying to execute rails commands

I am using ubunutu natty narwhal.I had installed ruby,rails,rvm etc.. sometime back and everything was running peacefully.Recently i tried to execute "rails -v" on the command line i get this frustrating error.
roger#roger-Inspiron-1545:~$ rails -v
bash: /home/roger/.rvm/gems/ruby-1.9.2-p180/bin/rails: /home/roger/.rvm/rubies/ruby- 1.9.2-p180/bin/ruby:
bad interpreter: Permission denied
I also get this error for other rails commands i execute
Can someone let me know what the problem is and how i can fix this.
Update:Whereis ruby gives me the this
roger#roger-Inspiron-1545:~$ whereis ruby
ruby: /usr/bin/ruby /usr/bin/ruby1.8 /usr/lib/ruby /usr/share/man/man1/ruby.1.gz
Thanks
run:
ls -l /home/roger/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
The first few characters of the entry should be "-rwx" and you should see your own username as the owner. If you don't see at least the "r" and the "x", run
chmod 755 /home/roger/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
to give the owner read/write/exec and everyone else read/execute.
If you aren't the owner, you'll need to do "sudo chown" to fix that.
I suspect that there's a bigger underlying problem though. If you have other ruby versions installed, switch to them in rvm, type "which ruby" and run "ls -l" on them as well.
Did you do a restore from backup recently? Maybe the permissions weren't correctly restored. Or did you run some kind of script that might've been too aggressive in changing owner or permissions? Or maybe you accidentally did a chmod or chown?

Resources