How to update i18n for yarn? - internationalization

How do I install i18n so that it is available when running commands via yarn?
What I want to do: yarn run serve (where serve is defined as jekyll serve) as well as yarn exec jekyll serve --...
What I get:
/usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler/runtime.rb:304:in `check_for_activated_spec!': You have already activated i18n 0.9.5, but your Gemfile requires i18n 1.12.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler/runtime.rb:25:in `block in setup'
from /usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler/spec_set.rb:155:in `each'
from /usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler/spec_set.rb:155:in `each'
from /usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler/runtime.rb:24:in `map'
from /usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler/runtime.rb:24:in `setup'
from /usr/local/rvm/gems/default/gems/bundler-2.4.5/lib/bundler.rb:170:in `setup'
from /usr/local/rvm/gems/default/gems/jekyll-3.9.2/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
from /usr/local/rvm/gems/default/gems/jekyll-3.9.2/exe/jekyll:11:in `<top (required)>'
from /usr/local/rvm/gems/default/bin/jekyll:25:in `load'
from /usr/local/rvm/gems/default/bin/jekyll:25:in `<main>'
What I tried:
yarn add i18n
yarn add -D i18n
yarn update
bundle add i18n; bundle install; bundle update
I could prefix the yarn task with bundle exec but that doesn't feel right either, as it clearly detects a version of i18n. So how do I update that?

Related

'Bundler could not find compatible versions for gem "jemoji"' when bundle exec jekyll serve

Actually I don't quite know what bundle nor jekyll is , but I am trying to execute bundle exec jekyll serve follow the guide https://github.com/apache/incubator-rocketmq-site , but fails.
I can't find google something similar like this so I post a question here.
$ bundle exec jekyll serve
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/resolver.rb:21 8:in `rescue in start': Bundler could not find compatible versions for gem "jemo ji": (Bundler::VersionConflict)
In Gemfile:
minimal-mistakes-jekyll x64-mingw32 was resolved to 4.1.0, which depends on
jemoji (~> 0.7) x64-mingw32
Could not find gem 'jemoji (~> 0.7) x64-mingw32', which is required by gem 'mini mal-mistakes-jekyll x64-mingw32', in any of the sources.
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/r esolver.rb:212:in `start'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/r esolver.rb:191:in `resolve'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/d efinition.rb:235:in `resolve'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/d efinition.rb:159:in `specs'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/d efinition.rb:218:in `specs_for'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/d efinition.rb:207:in `requested_specs'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/r untime.rb:109:in `block in definition_method'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/r untime.rb:21:in `setup'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler.r b:101:in `setup'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.15.3/lib/bundler/s etup.rb:19:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54 :in `require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54 :in `require'
How can I solve it?
Run bundle install alone first (step 4 in the linked README). This should install the necessary packages.
Then you can run bundle exec jekyll serve. The bundle exec means it will use those installed packages.

compass fails on arch

Running grunt serve which use to work I'm having this error message.
Running "compass:server" (compass) task
Warning: Command failed: compass --version
/usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:179:in `rescue in specs': Your bundle is locked to chunky_png (1.3.4), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of chunky_png (1.3.4) has removed it. You'll need to update your bundle to a different version of chunky_png (1.3.4) that hasn't been removed in order to install. (Bundler::GemNotFound)
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:173:in `specs'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:233:in `specs_for'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:222:in `requested_specs'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:118:in `block in definition_method'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:19:in `setup'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler.rb:99:in `setup'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /usr/bin/compass:6:in `<main>'
So on side I ran a compass --version and I obtain the same error Your bundle is locked to chunky_png (1.3.4), etc.
Trying to bundle install seems a bit useless...
$ bundle install
Could not locate Gemfile or .bundle/ directory
So I tried to reinstall ruby-compass because which compass sent me to /usr/bin/compass which is the one set by ruby-compass AUR package.
that did'nt solved the problem. Any idea around ?
solved by installing compass via pacgem
details of commands :
to install pacgem
cd ~/devel/aur.archlinux.org/ # or where ever you used to put your AUR
git clone https://aur.archlinux.org/pacgem.git
cd pacgem
cat PKGBUILD # at this point, it is recommended to personally check to PKGBUILD
makepkg -si
and answer y to all questions
install compass
pacgem compass
and answer y to all questions. It will install needed dependencies.

How to resolve ruby gem conflict involving rake on mac?

I am attempting to run rake under Mac OSX and I am getting the below error.
$ rake --trace
rake aborted!
Gem::ConflictError: Unable to activate releasy-0.2.2, because rake-10.3.2 conflicts with rake (~> 0.9.2.2)
/Library/Ruby/Site/2.0.0/rubygems/specification.rb:2112:in `raise_if_conflicts'
/Library/Ruby/Site/2.0.0/rubygems/specification.rb:1280:in `activate'
/Library/Ruby/Site/2.0.0/rubygems.rb:198:in `rescue in try_activate'
/Library/Ruby/Site/2.0.0/rubygems.rb:195:in `try_activate'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
/Users/Development/RUBY/rakefile:5:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'
gem list --local displays
rake (10.3.2, 0.9.6, 0.9.2.2)
How would I resolve a conflict between the rake gem I installed and the rake gem that is deployed with OSX? Should I just delete the newest update or is there a way to specify in my rake file to use the newest version and ignore the conflict?
If you are trying to run rake from within a project that uses a Gemfile, try this:
bundle exec rake --trace
This will load up the version of rake required for the project, instead of one that could possibly conflict (like your OSX default /usr/bin/rake binary).
If the bundle command isn't found, do this:
gem install bundler
Also, if this is a recent Rails app, you can also use the provided binstubs instead like this:
bin/rake --trace
If none of this works, try using RVM, Chruby, or RBEnv to manage your Ruby environments separately from the operating-system provided Ruby.

'grunt compass' throwing error that it's not in the system PATH

I'm pretty new to using grunt, compass, and sass and am having trouble getting it to work. I have a Redhat installation with Drupal 7 and when I try to run 'grunt compass' from within the site's theme directory I get the following error:
Running "compass:dist" (compass) task
Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass Use --force to continue.
Aborted due to warnings.
I've installed Grunt, Bower, and used 'bundle install' to install the needed gems. When I run 'gem list' I get the following:
bigdecimal (1.2.4)
breakpoint (2.0.7)
bundler (1.6.2)
bundler-unload (1.0.2)
chunky_png (1.3.1)
compass (0.12.6)
compass-normalize (1.4.3)
executable-hooks (1.3.1)
fssm (0.2.10)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
kss (0.5.0)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
ruby (0.1.0)
rubygems-bundler (1.4.3)
rubygems-update (2.2.2)
rvm (1.11.3.9)
sass (3.2.19)
test-unit (2.1.1.0)
zurb-foundation (4.3.2)
So it seems that I have all of the needed gems. I then looked at my PATH settings via 'echo $PATH' and got the following:
/home/ec2-user/.rvm/gems/ruby-2.1.1/bin:/home/ec2-user/.rvm/gems/ruby-2.1.1#global/bin:/home/ec2-user/.rvm/rubies/ruby-2.1.1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin:/home/ec2-user/.rvm/bin
I looked into the paths and see that in /usr/bin I have ruby2.0 and in /home/ec2-user/bin I have compass so the installations seem to be in the system PATH.
When I run 'ruby2.0' from the command line I get the following:
/usr/local/share/ruby/site_ruby/2.0/rubygems/ext/builder.rb:12:in `<class:Builder>': uninitialized constant Gem::UserInteraction (NameError)
from /usr/local/share/ruby/site_ruby/2.0/rubygems/ext/builder.rb:10:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/ext.rb:13:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:1431:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `each'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems.rb:185:in `try_activate'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/user_interaction.rb:8:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/config_file.rb:7:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:1430:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `each'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/share/ruby/site_ruby/2.0/rubygems.rb:185:in `try_activate'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/share/ruby/site_ruby/2.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from <internal:abrt_prelude>:2:in `<compiled>'
When I run simply 'ruby' nothing ever happens. Is 'grunt compass' looking to find 'ruby' and instead I have 'ruby2.0'? Do I need to create a symlink with ruby -> ruby2.0?
When I run 'compass' from the command line I get:
Usage: compass help [command]
Description:
The Compass Stylesheet Authoring Framework helps you
build and maintain your stylesheets and makes it easy
for you to use stylesheet libraries provided by others.
Etc.
Any thoughts would be appreciated
I've done some researching on this and the following worked for me...
If you have a windows build with Ruby and Compass installed via CLI then try;
Control Panel > System > Advanced system settings
Advanced > Environment Variables
Under System variables search for the 'path' variable which should have a value
Finally click edit and add ;C:\Ruby193\bin at the very end of the Variable value.
This should do the trick.
Note that ;C:\Ruby193\bin refers to the installation of Ruby > Compass on your machine.
If you have a Mac build then perhaps a similar version of fix could work for Mac but I couldn't map that for you, a bit of Googling might help...
grunt compass looks for a ruby gem. In your case 'compass -v' gives no error so the compass part works fine. outside this, it doesn't depend on any other component of ruby.
Now that compass is ready, grunt compass also looks for a npm module grunt-contrib-compass which you would find reference of in a package.json file. If you do a npm install this npm package gets installed and I believe it should make grunt compass work.
grunt-contrib-compass has a bundleExec option that makes the magic. With bundle it will load the gems installed using bundle install. Just set bundleExec: true
https://github.com/gruntjs/grunt-contrib-compass#bundleexec

Unable to programmatically run a Jekyll build

I'm trying to run a Jekyll build programatically, but I'm having issues in that the build crashes when trying to load some gems used by the Jekyll site's plugins.
My code looks like this (line breaks added for readability):
%x(cd #{#config['input_directory']} &&
bundle install &&
bundle exec jekyll build --config #{File.join(#config['input_directory'], "_config.yml")} --source #{#config['input_directory']} --destination #{#config['output_directory']} --trace)
When this runs, I get a stack trace that looks like this:
/_plugins/jekyll_lunr_js_search.rb:80:in `require': cannot load such file -- nokogiri (LoadError)
from /_plugins/jekyll_lunr_js_search.rb:80:in `<top (required)>'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:77:in `require'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:77:in `block (2 levels) in setup'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:76:in `each'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:76:in `block in setup'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:75:in `each'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:75:in `setup'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/site.rb:29:in `initialize'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/commands/build.rb:5:in `new'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/lib/jekyll/commands/build.rb:5:in `process'
from /ruby-1.9.3-p448/gems/jekyll-1.3.0/bin/jekyll:77:in `block (2 levels) in <top (required)>'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/runner.rb:78:in `run!'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/delegates.rb:11:in `run!'
from /ruby-1.9.3-p448/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
The Gemfile of the input_directory looks like this, so I'm not sure why it's not able to load nokogiri.
source 'https://rubygems.org'
gem 'directory_watcher', '= 1.4.1' # http://stackoverflow.com/questions/15591000/jekylls-auto-doesnt-work
gem 'kramdown'
gem 'nokogiri'
gem 'yui-compressor'
gem "jekyll"
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
end
Any pointers here are welcome. I get the feeling there are better ways of doing this Jekyll build programmatically too, this just seemed to be simplest to me.
Run bundle exec jekyll to ensure that it sets up the gem path correctly for Jekyll. If you're calling the program from an app that uses Bundler itself, you may need to also wrap the execution in a call to Bundler.with_clean_env.
The complete command should look like this:
Bundler.with_clean_env do
%x(cd #{#config['input_directory']} &&
bundle install &&
bundle exec jekyll build --config #{File.join(#config['input_directory'], "_config.yml")} --source #{#config['input_directory']} --destination #{#config['output_directory']} --trace)
end

Resources