【发布时间】:2019-10-14 21:16:05
【问题描述】:
我正在尝试在 heroku 上上传我的网络应用程序,但出现以下错误。
(我正在使用 Cloud 9 IDE 进行编码)
$ git push heroku master
.....
remote: -----> Installing node-v10.14.1-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: Yarn executable was not detected in the system.
remote: Download Yarn at https://yarnpkg.com/en/docs/install
remote: I, [2019-05-22T02:13:47.373334 #1766] INFO -- : Writing
/tmp/build_fcc84922ee6a02bfc05a163c871d0548/public/assets/noimage-
3aa3997354b4e9c37f379deb61626f55ade493078d1b42dcefe4a3ccbed34106.jpg
remote: rake aborted!
remote: ExecJS::RuntimeError: SyntaxError: Unexpected character '`'
remote: JS_Parse_Error.get ((execjs):3538:621)
remote: (execjs):4060:48
remote: (execjs):1:102
.....
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
首先,它说“系统中没有检测到Yarn可执行文件”,但是如果我用yarn -v检查它就可以正确下载。
另外,ExecJS :: RuntimeError: SyntaxError: Unexpected character '`' 错误好像是es6无法识别,作为解决办法
config.assets.js_compressor =: uglifier
config.assets.js_compressor = Uglifier.new(和谐:真)
改成这样好像可以读es6了。但上述错误仍然存在。
另外,如果我在控制台上运行“rake assets: precompile RAILS_ENV = production”,它会正常运行而不会出错。
谢谢。
【问题讨论】:
-
你在检查
heroku run yarn -v吗? -
@maxpleaner 感谢您的评论。它显示 Running yarn -v on ⬢ myapp... up, run.1301(免费) bash: yarn: command not found。所以这意味着heroku上没有纱线?如何在 heroku 中下载纱线?
标签: ruby-on-rails ruby heroku ruby-on-rails-5