Open wenq1 opened 4 years ago
Hi there, welcome to Ruby. Are you familiar with any other scripting language like Python or JavaScript? Would make it easier to explain RubyGems and Bundler in that case.
Yep. I use Javascript mainly.
I'm actually thinking about making an electron version of the editor. Reason being it will be able to be integrated to our team website which is built entirely using react and css.
Ok. So NPM by default installs packages locally in the project (in node_modules
folder), while RubyGems in contrast installs globally (think about npm install --global
). The exact folder of the global gem repository depends on where you installs the package manager (this is true for both NPM and RubyGems), and some of those folder may require root permission (technically speaking it’s permission of owner of the folder).
If you want local installation like NPM, then go with the --path
option to pass the local folder; current version of Bundler should be able to remember this folder so you only specifies it once. vendor/bundle
is just a convention; actually anywhere works.
If you want to install it globally you can simply run bundle install
and it should prompt for password (it’s using sudo
internally; if no prompt then it’s a bug). I wouldn’t recommend this path for you though, because
You can always learn global package (where they are, best practice, etc.) when you need to.
@wenq1 Usually the best practice is to leave the system ruby
installation alone, and use version management utilities e.g. rbenv
to sideload ruby
installations. Not only will you be able to install new gems without the need of root permission, it also prevents you from unknowingly breaking other applications outside of terminal.
rbenv install 2.7.0 && rbenv shell 2.7.0
gem install bundler
bundle install
New to ruby. Asking a few basic questions:
With a normal user,
bundle install
returns:After continuing,
Gem::InstallError: minitest requires Ruby version ~> 2.2. An error occurred while installing minitest (5.14.0), and Bundler cannot continue. Make sure that
gem install minitest -v '5.14.0'
succeeds before bundling.My ruby version is: wc$ ruby --version ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
With root user (which i don't like), it prompted immediatly as follows: