How to replace therubyracer javascript runtime

杀马特。学长 韩版系。学妹 提交于 2021-02-10 14:33:25

问题


How do I replace the therubyracer gem? I'm really stuck.

We have been using the therubyracer gem for our Rails asset pipeline. However, it is using dependencies which are past their end of life and have security vulnerabilities. The latest version 0.12.3 is from January 05, 2017.

I have looked at the mini_racer gem, but we deploy to FreeBSD and the latest version supported on FreeBSD is 0.1.14 from August 24, 2017. We develop on macOS and my compile of this version of mini_racer gets errors, one of which because CreateDefaultPlatform has been removed from V8.

The list of runtimes supported by execjs, at https://github.com/rails/execjs lists Node.js and Google V8 but the links go to pages which don't look like gems I can replace in my Gemfile, neither do those pages have documentation on how to use their runtime for execjs. I honestly am stuck with no idea how to use a newer runtime in my Rails pipeline.


回答1:


Using therubyracer has generally been superseded by using a NodeJS installation that is on the machine itself, meaning it wouldn't be installed as a gem. Gem installations that require a JS runtime to build should be smart enough to find your locally installed NodeJS.

So locally, you should just be able to remove therubyracer from your Gemfile, assuming you don't have other gems that depend on it. If you do, those are probably outdated or abandoned. Your build pipeline will need to be modified to install NodeJS before the bundle install.



来源:https://stackoverflow.com/questions/65617815/how-to-replace-therubyracer-javascript-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!