As a minimal mistake Jekyll theme user, I use the following commands to set up and use npm, gem, and bundler.

npm

“npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.”, https://docs.npmjs.com/cli/v6/commands/npm

Installation / Update

  • Install npm
    $ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    $ sudo apt-get update
    $ sudo apt-get -y install nodejs
    

    Note: You may need sudo apt-get -y install nodejs make gcc g++.

  • Update npm
    $ sudo npm install -g npm@latest
    

Usage

  • Install packages (based on package.json)
    $ sudo npm install
    
  • Run scripts
    $ sudo npm run build:js
    

Gem and Bundler

“The RubyGems software allows you to easily download, install, and use ruby software packages on your system. The software package is called a “gem” which contains a packaged Ruby application or library.”, https://guides.rubygems.org/

“Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed.”, https://bundler.io/

Installation

  • Install gem and bundler
    $ sudo apt-get install build-essential patch
    $ sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
    $ gem install bundler
    

    Note: For bundler, you may need gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)", if you have problem in using bundler.

  • Install dependencies using bundler (based on Gemfile)
    $ bundle install
    
  • Run local jekyll server
    $ bundle exec jekyll serve --host .. --port .. --livereload
    

References

  1. How to Install Node.js and npm on Ubuntu 20.04
  2. Try the latest stable version of npm
  3. https://linuxize.com/post/how-to-install-ruby-on-ubuntu-18-04/
  4. https://bundler.io/

Tags:

Categories:

Updated: