Sha256: 2c7c78596234a3f3fe228005c655e08a8a99071105ef912f4ae7eb9d7f17383a

Contents?: true

Size: 928 Bytes

Versions: 47

Compression:

Stored size: 928 Bytes

Contents

namespace :webpacker do
  desc "Verifies if Node.js is installed"
  task :check_node do
    begin
      node_version = `node -v || nodejs -v`
      raise Errno::ENOENT if node_version.blank?

      pkg_path = Pathname.new("#{__dir__}/../../../package.json").realpath
      node_requirement = JSON.parse(pkg_path.read)["engines"]["node"]

      requirement = Gem::Requirement.new(node_requirement)
      version = Gem::Version.new(node_version.strip.tr("v", ""))

      unless requirement.satisfied_by?(version)
        $stderr.puts "Webpacker requires Node.js #{requirement} and you are using #{version}"
        $stderr.puts "Please upgrade Node.js https://nodejs.org/en/download/"
        $stderr.puts "Exiting!" && exit!
      end
    rescue Errno::ENOENT
      $stderr.puts "Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/"
      $stderr.puts "Exiting!" && exit!
    end
  end
end

Version data entries

47 entries across 47 versions & 4 rubygems

Version Path
webpacker-4.3.0 lib/tasks/webpacker/check_node.rake
jetpacker-0.4.2 lib/tasks/webpacker/check_node.rake
jetpacker-0.4.1 lib/tasks/webpacker/check_node.rake
jetpacker-0.4.0 lib/tasks/webpacker/check_node.rake
jetpacker-0.3.0 lib/tasks/webpacker/check_node.rake
jetpacker-0.2.0 lib/tasks/webpacker/check_node.rake
webpacker-4.2.2 lib/tasks/webpacker/check_node.rake
webpacker-4.2.1 lib/tasks/webpacker/check_node.rake
webpacker-4.2.0 lib/tasks/webpacker/check_node.rake
webpacker-4.1.0 lib/tasks/webpacker/check_node.rake
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/lib/tasks/webpacker/check_node.rake
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/lib/tasks/webpacker/check_node.rake
webpacker-4.0.7 lib/tasks/webpacker/check_node.rake
webpacker-4.0.6 lib/tasks/webpacker/check_node.rake
webpacker-4.0.5 lib/tasks/webpacker/check_node.rake
webpacker-4.0.4 lib/tasks/webpacker/check_node.rake
webpacker-4.0.3 lib/tasks/webpacker/check_node.rake
webpacker-4.0.2 lib/tasks/webpacker/check_node.rake
webpacker-3.6.0 lib/tasks/webpacker/check_node.rake
webpacker-4.0.1 lib/tasks/webpacker/check_node.rake