Deploying Rails, but getting Node error?

Hey everyone, I was updating an older Rails application (Rails 6.0.0, Ruby 3.0.1) I was running without problems. Just changed a few lines of text in the HTML, so theoretically no big cause for concern.

But when I pushed to Github, I got an error that seems somewhat “disguised”, early on it’s complaining about a node version, and later getting a build error caused by sprockets-3.7.2. I’m not using Node explicitly that I know of, so is there some dependency issue I need to attend? Maybe I’m missing something about the default platform versions? A bit lost, if anyone can help, would appreciate.

Here’s the Gemfile and the logs.

Gemfile

source 'https://rubygems.org'

ruby "3.0.1"

gem 'rails', '~> 6.0.0', '>= 6.0.0.1'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'

gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'

gem 'sendgrid-ruby', '>= 6.0'

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Logs

Aug 16 02:38:17 PM==> Downloading cache...

Aug 16 02:38:34 PM==> Using Ruby version 3.0.1 via /opt/render/project/src/Gemfile.lock

Aug 16 02:38:34 PM==> Docs on specifying a Ruby version: https://render.com/docs/ruby-version

Aug 16 02:38:35 PM==> Running build command './bin/render-build.sh'...

Aug 16 02:38:35 PMUsing rake 13.0.6

Aug 16 02:38:35 PMUsing concurrent-ruby 1.2.2

Aug 16 02:38:35 PMUsing i18n 1.14.1

Aug 16 02:38:35 PMUsing minitest 5.19.0

Aug 16 02:38:35 PMUsing thread_safe 0.3.6

Aug 16 02:38:35 PMUsing tzinfo 1.2.11

Aug 16 02:38:35 PMUsing zeitwerk 2.6.11

Aug 16 02:38:35 PMUsing activesupport 6.0.6.1

Aug 16 02:38:35 PMUsing builder 3.2.4

Aug 16 02:38:35 PMUsing erubi 1.12.0

Aug 16 02:38:35 PMUsing racc 1.7.1

Aug 16 02:38:35 PMUsing nokogiri 1.15.4 (x86_64-linux)

Aug 16 02:38:35 PMUsing rails-dom-testing 2.2.0

Aug 16 02:38:35 PMUsing crass 1.0.6

Aug 16 02:38:35 PMUsing loofah 2.21.3

Aug 16 02:38:35 PMUsing rails-html-sanitizer 1.6.0

Aug 16 02:38:35 PMUsing actionview 6.0.6.1

Aug 16 02:38:35 PMUsing rack 2.2.8

Aug 16 02:38:35 PMUsing rack-test 2.1.0

Aug 16 02:38:35 PMUsing actionpack 6.0.6.1

Aug 16 02:38:35 PMUsing nio4r 2.5.9

Aug 16 02:38:35 PMUsing websocket-extensions 0.1.5

Aug 16 02:38:35 PMUsing websocket-driver 0.7.6

Aug 16 02:38:35 PMUsing actioncable 6.0.6.1

Aug 16 02:38:35 PMUsing globalid 1.1.0

Aug 16 02:38:35 PMUsing activejob 6.0.6.1

Aug 16 02:38:31 PM==> Transferred 141MB in 8s. Extraction took 4s.

Aug 16 02:38:35 PMUsing activemodel 6.0.6.1

Aug 16 02:38:35 PMUsing activerecord 6.0.6.1

Aug 16 02:38:35 PMUsing marcel 1.0.2

Aug 16 02:38:35 PMUsing activestorage 6.0.6.1

Aug 16 02:38:35 PMUsing mini_mime 1.1.5

Aug 16 02:38:35 PMUsing date 3.3.3

Aug 16 02:38:35 PMUsing timeout 0.4.0

Aug 16 02:38:35 PMUsing net-protocol 0.2.1

Aug 16 02:38:35 PMUsing net-imap 0.3.7

Aug 16 02:38:35 PMUsing net-pop 0.1.2

Aug 16 02:38:35 PMUsing net-smtp 0.3.3

Aug 16 02:38:35 PMUsing mail 2.8.1

Aug 16 02:38:35 PMUsing actionmailbox 6.0.6.1

Aug 16 02:38:35 PMUsing actionmailer 6.0.6.1

Aug 16 02:38:35 PMUsing actiontext 6.0.6.1

Aug 16 02:38:35 PMUsing bundler 2.3.26

Aug 16 02:38:35 PMUsing coffee-script-source 1.12.2

Aug 16 02:38:35 PMUsing execjs 2.8.1

Aug 16 02:38:35 PMUsing coffee-script 2.4.1

Aug 16 02:38:35 PMUsing method_source 1.0.0

Aug 16 02:38:35 PMUsing thor 1.2.2

Aug 16 02:38:35 PMUsing railties 6.0.6.1

Aug 16 02:38:35 PMUsing coffee-rails 4.2.2

Aug 16 02:38:35 PMUsing ffi 1.15.5

Aug 16 02:38:35 PMUsing jbuilder 2.11.5

Aug 16 02:38:35 PMUsing jquery-rails 4.6.0

Aug 16 02:38:35 PMUsing puma 3.12.6

Aug 16 02:38:35 PMUsing sprockets 3.7.2

Aug 16 02:38:35 PMUsing sprockets-rails 3.4.2

Aug 16 02:38:35 PMUsing rails 6.0.6.1

Aug 16 02:38:35 PMUsing rb-fsevent 0.11.2

Aug 16 02:38:35 PMUsing rb-inotify 0.10.1

Aug 16 02:38:35 PMUsing ruby_http_client 3.5.5

Aug 16 02:38:35 PMUsing sass-listen 4.0.0

Aug 16 02:38:35 PMUsing sass 3.7.4

Aug 16 02:38:35 PMUsing tilt 2.2.0

Aug 16 02:38:35 PMUsing sass-rails 5.1.0

Aug 16 02:38:35 PMUsing sendgrid-ruby 6.6.2

Aug 16 02:38:35 PMUsing turbolinks-source 5.2.0

Aug 16 02:38:35 PMUsing turbolinks 5.2.1

Aug 16 02:38:35 PMUsing uglifier 4.2.0

Aug 16 02:38:35 PMBundle complete! 15 Gemfile dependencies, 67 gems now installed.

Aug 16 02:38:35 PMGems in the groups 'development' and 'test' were not installed.

Aug 16 02:38:35 PMBundled gems are installed into `/opt/render/project/.gems`

Aug 16 02:38:38 PMrails aborted!

Aug 16 02:38:38 PMJSON::ParserError: 809: unexpected token at '==> Using Node version 14.17.0 (default)

Aug 16 02:38:38 PM==> Docs on specifying a Node version: https://render.com/docs/node-version

Aug 16 02:38:38 PM==> Using Bun version (default)

Aug 16 02:38:38 PM==> Docs on specifying a bun version: https://render.com/docs/bun-version

Aug 16 02:38:38 PM["ok"]'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/external_runtime.rb:68:in `extract_result'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/external_runtime.rb:39:in `exec'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/external_runtime.rb:14:in `initialize'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/runtime.rb:72:in `new'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/runtime.rb:72:in `compile'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/module.rb:27:in `compile'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/uglifier-4.2.0/lib/uglifier.rb:184:in `context'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:53:in `call'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:28:in `call'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/railties-6.0.6.1/lib/rails/command.rb:48:in `invoke'

Aug 16 02:38:38 PM/opt/render/project/.gems/ruby/3.0.0/gems/railties-6.0.6.1/lib/rails/commands.rb:18:in `<top (required)>'

Aug 16 02:38:38 PMbin/rails:9:in `require'

Aug 16 02:38:38 PMbin/rails:9:in `<main>'

Aug 16 02:38:38 PMTasks: TOP => assets:precompile

Aug 16 02:38:38 PM(See full trace by running task with --trace)

Aug 16 02:38:38 PM==> Build failed 😞

Aug 16 02:38:38 PM==> Common ways to troubleshoot your deploy: https://docs.render.com/troubleshooting-deploys

Apperciate you reading, thanks.

Add node --version to the start of your render-build.sh script;

In an effort to reduce image sizes, Node is available as a stub on non-Node services, the first time it is invoked it is loaded in. However, this includes the output we add about the version of it (and Bun) being used. You can see in the “JSON::ParserError” bit that there is version information with a trailing ["ok"]. ["ok"] is supposed to be the only thing printed, but the rest of our output causes the entire chunk of output to be invalid JSON.

Thus, you need to fully load Node in before it is needed to be used (by execjs I assume?).

Thanks, Jason.

I did as you said and added node --version to the start of my render-build.sh script. It worked, it built and deployed. I don’t know if it’s being used by execjs, like you mentioned.

Just so I understand this for the future, it has nothing to do with the Ruby or Rails version itself, it’s just for image compatibility across your platform. Does this apply to all projects, or Rails projects?

Thanks for your help.

This applies to all non-Node services. Node is available in every Native Environment type (Ruby, Python, Go, not Docker though) because of its prevalence in frontend design, but it is only a stub on non-Node services. Obviously on Node services it is immediately available.

Understood, makes sense. Thanks for clearing it up.

All the best.