Skip to content

Commit

Permalink
Fix cannot find version of process
Browse files Browse the repository at this point in the history
- The error occurs that is because of execjs has been changed `process to `this.process`.
- Fix ai#203
  • Loading branch information
ksh-code committed May 24, 2021
1 parent b12a0d8 commit 331cda3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions autoprefixer-rails.gemspec
Expand Up @@ -20,9 +20,6 @@ Gem::Specification.new do |s|
s.homepage = "https://github.com/ai/autoprefixer-rails"
s.license = "MIT"

# see #203, `process` is undefined in 2.8
s.add_dependency "execjs", "< 2.8.0"

s.add_development_dependency "rails"
s.add_development_dependency "rake"
s.add_development_dependency "rspec-rails"
Expand Down
6 changes: 3 additions & 3 deletions lib/autoprefixer-rails/processor.rb
Expand Up @@ -9,7 +9,7 @@
module AutoprefixerRails
# Ruby to JS wrapper for Autoprefixer processor instance
class Processor
SUPPORTED_RUNTIMES = [ExecJS::Runtimes::Node, ExecJS::Runtimes::MiniRacer]
SUPPORTED_RUNTIMES = [ExecJS::Runtimes::Node, ExecJS::Runtimes::MiniRacer].freeze

def initialize(params = {})
@params = params || {}
Expand Down Expand Up @@ -131,7 +131,7 @@ def find_config(file)
def runtime
@runtime ||= begin
if ExecJS.runtime == ExecJS::Runtimes::Node
version = ExecJS.runtime.eval("process.version")
version = ExecJS.runtime.eval("this.process.version")
major = version.match(/^v(\d+)/)[1].to_i

# supports 10, 12, 14+
Expand All @@ -147,7 +147,7 @@ def runtime
# Only complain about unsupported runtimes when it failed to parse our script.
raise <<~MSG
Your ExecJS runtime #{ExecJS.runtime.name} isn't supported by autoprefixer-rails,
please switch to #{SUPPORTED_RUNTIMES.map(&:name).join(' or ')}
please switch to #{SUPPORTED_RUNTIMES.map(&:name).join(" or ")}
MSG
end
end
Expand Down

0 comments on commit 331cda3

Please sign in to comment.