美文网首页
解决 runtimes.rb:58:in `autodetect

解决 runtimes.rb:58:in `autodetect

作者: 前端技术小咖 | 来源:发表于2020-10-21 21:02 被阅读0次

    今天使用zat工具进行打包,但安装后执行发现会报以下错误:

    Traceback (most recent call last):
        13: from /usr/local/bin/zat:23:in `<main>'
        12: from /usr/local/bin/zat:23:in `load'
        11: from /Library/Ruby/Gems/2.6.0/gems/zendesk_apps_tools-3.8.1/bin/zat:13:in `<top (required)>'
        10: from /Library/Ruby/Gems/2.6.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
         9: from /Library/Ruby/Gems/2.6.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
         8: from /Library/Ruby/Gems/2.6.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
         7: from /Library/Ruby/Gems/2.6.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
         6: from /Library/Ruby/Gems/2.6.0/gems/zendesk_apps_tools-3.8.1/lib/zendesk_apps_tools/command.rb:121:in `package'
         5: from /Library/Ruby/Gems/2.6.0/gems/zendesk_apps_tools-3.8.1/lib/zendesk_apps_tools/command.rb:88:in `validate'
         4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         2: from /Library/Ruby/Gems/2.6.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
         1: from /Library/Ruby/Gems/2.6.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
    /Library/Ruby/Gems/2.6.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    

    解决方案:

    安装notejs可以解决以上问题,不同系统的安装方式如下:

    1)Windows & macOS系统

    打开Notejs官网,下载Notejs安装包安装即可。

    2)Linux 系统

    a) Ubuntu 安装Notejs命令

    sudo apt-get install nodejs
    

    b) CentOS安装Notejs命令

    sudo yum install nodejs
    

    问题原因:

    缺少JavaScript的运行环境,安装Notejs即可解决。

    如果这个方案解决了您的问题,别忘了点赞♥️,让其他同学也知道这个正确的方法。

    参考链接:
    1. https://stackoverflow.com/questions/9202324/execjs-could-not-find-a-javascript-runtime-but-execjs-and-therubyracer-are-in

    相关文章

      网友评论

          本文标题:解决 runtimes.rb:58:in `autodetect

          本文链接:https://www.haomeiwen.com/subject/xvzemktx.html