แก้ปัญหา gem install bundler ไม่ผ่านติด permission

bundler 3 พ.ค. 2017

เนื่องจากงานที่ทำเป็นงานที่ต้องใช้ drupal ร่วมกับ theme เดิมที่มีคนพัฒนาไว้อยู่แล้ว env หลายอย่างถูกพัฒนาขึ้นไปอย่างมาก

By the moment, the last stable versions I’ve tested of each gem and that work together are:

WORKS

breakpoint (2.0.7)
compass (0.12.3)
sass (3.2.14)
susy (2.0.0.alpha.4)
zen-grids (1.4)
STILL NOT WORK

breakpoint (2.4.1)
compass (1.0.0.alpha.18)
sass (3.3.2)
susy (2.0.0)
zen-grids (2.0.0.beta.2)

To get the install command for each gem, and know each dependencies and versions:

Example SASS https://rubygems.org/gems/sass/

Some more info about deprecated browser legacy support method: http://www.atendesigngroup.com/blog/new-browser-support-features-compass-1x

https://www.drupal.org/node/2188263#comment-8567655

แต่จำเป็นต้องใช้ของเก่า ตามรายละเอียดด้านบน ซึ่งในระบบติดตั้ง bundler ไว้ ซึ่งสามารถช่วยให้ติดตั้ง gem versions เก่าได้ในครั้งเดียวเมื่อใช้คำสั่ง

$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Installing chunky_png 1.3.4
Installing fssm 0.2.10
Installing sass 3.2.14
Using bundler 1.14.6
Installing compass 0.12.3
Installing sass-globbing 1.1.1
Installing zen-grids 1.4
Installing breakpoint 2.0.7
Installing sassy-buttons 0.2.6
Installing susy 2.0.0.alpha.4
Bundle complete! 7 Gemfile dependencies, 10 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

$ bundle show compass
/Users/evolution/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/compass-0.12.3

แต่ bundler ต้องติดตั้งโดยไม่ผ่าน permission ถึงจะไม่มีปัญหาตามมา เลยทำให้ตองแก้ตามนี้

https://stackoverflow.com/questions/29932409/bundle-command-not-found-mac/32190234


Just reiterating that for those (at least on OSX) for whom

gem install bundler

Gives a permissions error, an option that seems to have worked for many people is to use rbenv, which kind of adds a shim between your ruby commands (like gem install) and your environment (if my understanding is correct).

Definitely check out this answer.

The process is laid out fairly well under the above link. I chose to install via homebrew:

brew update
brew install rbenv

Then you have to add an argument command to your profile, which if you’re using the common ~/.bash_profile, can be done with:

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Which it looks like is adding a command to initialize rbenv via your shell.

Don’t for get to start a new shell, possibly by opening a new terminal or using the source ~/.bash_profile command.

Make sure your $PATH has this .rbenv/shims BEFORE any other directory where your shell might be looking for Ruby (OSX comes with it’s own version that we don’t want to fiddle with): echo $PATH.

which ruby
/Users/mikekilmer/.rbenv/shims/ruby
#GOOD!

Now install a version of Ruby:

rbenv install 2.2.3 

(See all possible versions with rbenv install -l).

Now we can use rbenv global 2.2.3 to switch to a use the newer version of Ruby globally. (Hmm. I thought we didn’t want to mess with the system version.) You could also try it with rbenv local 2.2.3 or rbenv shell 2.2.3.

Finally run:

rbenv rehash

Now ruby -v should return 2.2.3 and gem install bundler should work.

Did here.

แท็ก

Onyx

Just a middle-aged programmer, Can do many things but not the most.