ExecJS::RuntimeError on Windows trying to follow rubytutorial

后端 未结 13 2149
清歌不尽
清歌不尽 2020-11-22 07:27

UPDATE: Colin\'s suggestion of removing the line //= require_tree . has fixed the issue.

I have wasted over 2 days trying to follow every suggestion

13条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 07:32

    I know this is a very late answer for this issue, but I got on something similar and went down the full path to understand what was really causing the issue.

    Turned out that the default windows jscript engine is still on es3, and many gems are taking advantage of es5 or es6 features. Unfortunately if this happen (you are using a gem or a piece of code that leverage es5 or es6 features), there is no way to let it work on windows with the native js engine.

    This is the reason why installing node.js solves the problem (node is at least es5).

    Hope this can help some folks struggling with a runtime error of jsexec.

    My 2 cents advise is to install node(very easy) or install v8, and not removing the //=require_tree.

    Note execjs will automatically use node if detected. Otherwise force its use, adding in boot something like:

    ENV['EXECJS_RUNTIME'] = 'Node'
    

    To set the env to node.

提交回复
热议问题