BlogNotesAbout
moon indicating dark mode
sun indicating light mode

How to fix libv8 "bad version" error when using mini_racer

March 10, 2020

TL;DR

Run bundle update mini_racer

The Issue I Experienced

I’ve been dealing with issues on my Mac for a while, so yesterday I decided to give in and wipe it. I upgraded to MacOS Catalina, then wiped my partition and did a fresh install.

In a few hours, I had almost everything running. Today, I tried to run bundle install to setup a Rails project’s dependencies and I was greeted by this:

Error: Command 'cipd ensure -log-level error -root
/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor
-ensure-file /var/folders/9l/2jz0cz8x56nbz806ty1fwwkh0000gn/T/tmpDPKTcT.ensure'
returned non-zero exit status 1
**\_\_\_\_** running 'cipd ensure -log-level error -root
/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor
-ensure-file /var/folders/9l/2jz0cz8x56nbz806ty1fwwkh0000gn/T/tmpDPKTcT.ensure'
in '.'
Error: failed to resolve package version (line 5): bad version (not an instance
ID, a ref or a tag): "M56jPzDv1620Rnm\_\_jTMYS62Zi8rxHVq7yw0qeBFEgkC".
Running: gclient root
Running: gclient config --spec 'solutions = [
{
"url": "https://chromium.googlesource.com/v8/v8.git",
"managed": False,
"name": "v8",
"deps_file": "DEPS",
"custom_deps": {},
},
]
'
Running: gclient sync --with_branch_heads
Traceback (most recent call last):
File
"/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/depot_tools/fetch.py",
line 306, in <module>
sys.exit(main())
File
"/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/depot_tools/fetch.py",
line 301, in main
return run(options, spec, root)
File
"/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/depot_tools/fetch.py",
line 295, in run
return checkout.init()
File
"/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/depot_tools/fetch.py",
line 137, in init
self.run_gclient(\*sync_cmd)
File
"/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/depot_tools/fetch.py",
line 82, in run_gclient
return self.run(cmd_prefix + cmd, **kwargs)
File
"/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/vendor/depot_tools/fetch.py",
line 71, in run
subprocess.check_call(cmd, **kwargs)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('gclient', 'sync',
'--with_branch_heads')' returned non-zero exit status 1
/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/ext/libv8/builder.rb:79:in
`block in setup_build_deps!': unable to fetch v8 source (RuntimeError)

There are two important lines here:

Error: failed to resolve package version (line 5): bad version (not an instance ID, a ref or a tag): “M56jPzDv1620Rnm__jTMYS62Zi8rxHVq7yw0qeBFEgkC”.

and

/Users/brandoncc/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/libv8-6.7.288.46.1/ext/libv8/builder.rb:79:in `block in setup_build_deps!’: unable to fetch v8 source (RuntimeError)


I tried every solution I could find for libv8 not compiling on a Mac. Most of them looked a lot like this one:

$ brew install v8@3.15
$ bundle config build.libv8 --with-system-v8
$ bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8@3.15)
$ bundle install

The Solution

Nothing I did resolved my issue…until I found my way to this comment, which made me wonder if mini_racer needed to be updated in order to be compatible with MacOS Catalina.

I ran bundle update mini_racer, and sure enough… my bundle installed!

Thank You, Friend

Thanks for stopping by, I really hope this helped you!


Brandon Conway
I enjoy learning about and writing code in many programming languages