How do I resolve a permission error installing a custom built gem?
I'm attempting to build my first ruby gem and all seemed to go well until I attempted to install the gem. I'm using RVM so no need for 'sudo gem install' here.
Fi开发者_如何学Gorst I attempted to do the following:
jim:~/Desktop/spectest \ [git:master]
→ rake manifest
(in /Users/jim/Desktop/spectest)
Cleaning
- pkg
rm -rf pkg
Building Manifest
Manifest
README
Rakefile
bin/buildcss
...
jim:~/Desktop/spectest \ [git:master]
→ rake install
(in /Users/jim/Desktop/spectest)
Cleaning
Gemspec generated
mkdir -p pkg
mkdir -p pkg/css-reader-0.1.0
rm -f pkg/css-reader-0.1.0/Manifest
...
cd pkg
tar zcvf css-reader-0.1.0.tar.gz css-reader-0.1.0
a css-reader-0.1.0
a css-reader-0.1.0/bin
...
cd -
WARNING: description and summary are identical
Successfully built RubyGem
Name: css-reader
Version: 0.1.0
File: css-reader-0.1.0.gem
mv css-reader-0.1.0.gem pkg/css-reader-0.1.0.gem
Private key not found; gem will not be signed.
Targeting "ruby" platform.
Password:
Sorry, try again.
Password:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d css-reader`
Successfully installed css-reader-0.1.0
1 gem installed
Installing ri documentation for css-reader-0.1.0...
Updating class cache with 3288 classes...
Installing RDoc documentation for css-reader-0.1.0...
Ok - so I wasn't certain why I got the Gem::InstallError here. Is there a log ruby gems keeps that I can find more details regarding the error? Either way I attempted to try installing the .gem package directly:
gem install pkg/css-reader-0.1.0.gem
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/jim/.rvm/gems/ruby-1.9.2-preview1/gems/css-reader-0.1.0/Manifest
And I get a bit more feedback. This time it looks like a permissions error with the Manifest file. So I attempted to chmod 777 the Manifest file and repeat the process all over again but I keep getting the error. Seems like a novice mistake somewhere on my behalf. Any advice is appreciated!
It is possible at some stage that you had something run with sudo which messed up your permisisons. Have you tried chown -R jim ~/.rvm
I solved the problem changing the ~/.gem permissions:
sudo chown user ~/.gem -R
right on. solved a similar problem. i had ~/.gem directory locked down for some reason while switching between sudo and such. Thanks!
精彩评论