首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Heroku ExecJS::RuntimeError: SyntaxError:预期名称

Heroku ExecJS::RuntimeError: SyntaxError:预期名称
EN

Stack Overflow用户
提问于 2017-09-18 01:44:54
回答 2查看 875关注 0票数 0

在推到Heroku时,我遇到了以下错误。前几天工作得很好。在我试图推动的提交上没有重大的配置更改。我很困惑如何解决这个问题。Rails 5.1应用程序使用以下构建包:

代码语言:javascript
复制
1. heroku/nodejs
2. heroku/ruby

我在利用网络包装机和纱线。我认为这与此有关,但很难找到更多的信息。

代码语言:javascript
复制
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v0.27.5
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        warning fsevents@1.1.2: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        [4/4] Building fresh packages...
remote:        Done in 6.62s.
remote:        rake aborted!
remote:        ExecJS::RuntimeError: SyntaxError: Name expected
remote:        JS_Parse_Error.get ((execjs):3538:621)
remote:        (execjs):4060:47
remote:        (execjs):1:102
remote:        Object.<anonymous> ((execjs):1:120)
remote:        Module._compile (module.js:571:32)
remote:        Object.Module._extensions..js (module.js:580:10)
remote:        Module.load (module.js:488:32)
remote:        tryModuleLoad (module.js:447:12)
remote:        Function.Module._load (module.js:439:3)
remote:        Module.runMain (module.js:605:10)
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/uglifier-3.2.0/lib/uglifier.rb:195:in `run_uglifyjs'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/uglifier-3.2.0/lib/uglifier.rb:157:in `compile'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:53:in `call'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_d7b1075d17c0c421422ebdbfc017919a/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected ....

经过进一步的研究,发现了与乌贼有关的问题。当我复制第三方库datepicker.js的内容并将其粘贴到Uglifier中时,我会得到相同的错误:

代码语言:javascript
复制
> Uglifier.compile( <<< file contents >>> )
ExecJS::RuntimeError: SyntaxError: Name expected
from JS_Parse_Error.get ((execjs):3538:621)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-09-18 22:46:02

我发现,这个问题的原因与Uglifier中的一个可能的错误有关,当它试图处理一个名为datepicker.js (datepicker.js)的第三方库时。我打开了一个关于“丑小怪”的问题:https://github.com/lautis/uglifier/issues/124

我想出了一个解决办法,在我的app/assets/javascripts/application.js文件中包含了精简的javascripts文件,如下所示。

代码语言:javascript
复制
//= require js-datepicker/datepicker.min
票数 1
EN

Stack Overflow用户

发布于 2017-09-18 02:08:16

我相信这个问题与您的yarn服务器上的linux安装有关。

实际上,您可以在yarn github存储库中找到该文件。

纱线喷口.1.1.2

此外,您还可以找到类似的问题,在这些问题中,纱线的heroku安装会因同样的错误warning fsevents@1.1.2: The platform "linux" is incompatible with this module.而失败。

错误是相同的警告fsevents@1.1.2:平台"linux“与此模块不兼容。info "fsevents@1.1.2“是一个可选的依赖项,并且兼容性检查失败。将其排除在安装之外.

Heroku未能在linux平台上安装纱线。

在Rails 5.1中添加了纱线,我也必须排除这个错误,我也在这方面打开了一个问题。

我的问题正在开发中,因为我有Linux 。可能在开发中安装纱线使我在生产中没有遇到这个问题。

不过,在用node.js进行开发时安装它仍然有问题,所以我最终使用了npm命令npm install yarn -g,您可以使用heroku run npm install yarn -g在heroku服务器上运行它,或者可以使用nodejs,纱线安装指南是可以听到的。

https://yarnpkg.com/en/docs/install

此外,这是一个非常相似的问题列表的查询,您可以阅读这些帖子,并可能找到解决问题的方法。这个问题不是来自rails,而是来自其他使用nodejs的框架。

在本例中,您还安装了带有nodejs的纱线,所以问题可能与nodejs有关。

b&ia=qa

FSEvents API的解释

这似乎是fsevents的依赖问题。您的操作系统Arch Linux不支持它。如果您转到Strongloop的fsevents Github页面,您将在他们的自述中看到这一点。 本机访问OS X FSEvents in Node.js OS中的FSEvents API允许应用程序注册对给定目录树的更改通知。它是kqueue的一个非常快速和轻量级的替代方案。所以,我想说这不是亚恩的问题。其他错误可能是以前失败的结果。

阅读更多

https://github.com/yarnpkg/yarn/issues/2142

无论如何,他们应该用这个方法解决这个问题。

https://github.com/yarnpkg/yarn/pull/2279

如果你不能解决这个问题,也许你可以打开一个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46270497

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档