首页 > 解决方案 > Heroku 构建失败找不到 webpack

问题描述

我的 Rails 6 heroku build 似乎找不到 webpack 的副本。我不小心添加/tmp.slugignore我认为是导致此问题的原因,但我不明白为什么。从那以后我已经删除/tmp了,.slugignore但问题仍然存在。该应用程序多年来一直运行良好。就像我一直依赖旧的 webpack 一样?但是/tmp当heroku构建开始时应该是空的吗?对此非常困惑。我从未使用过任何节点或 webpack heroku buildpacks,但也许我应该?

这是错误的快照:

-----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   /tmp/build_6ab5739c16c73857f5e476d061484644/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.4.3/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
   /tmp/build_6ab5739c16c73857f5e476d061484644/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.4.3/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here
   /tmp/build_6ab5739c16c73857f5e476d061484644/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
   /tmp/build_6ab5739c16c73857f5e476d061484644/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/static.rb:111: warning: The called method `initialize' is defined here
   /tmp/build_6ab5739c16c73857f5e476d061484644/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
   /tmp/build_6ab5739c16c73857f5e476d061484644/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.4.3/lib/action_dispatch/middleware/ssl.rb:59: warning: The called method `initialize' is defined here
   yarn install v1.16.0
   [1/5] Validating package.json...
   error @1.7.0: The engine "node" is incompatible with this module. Expected version ">=14.0.0". Got "10.15.3"
   error Found incompatible module.
   info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
   autoprefixer: /tmp/build_6ab5739c16c73857f5e476d061484644/app/assets/stylesheets/application.css.scss:5944:5: Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`.
   autoprefixer: /tmp/build_6ab5739c16c73857f5e476d061484644/app/assets/stylesheets/application.css.scss:9297:5: Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`.
   Compiling...
   Compilation failed:
   sh: 1: /tmp/build_6ab5739c16c73857f5e476d061484644/node_modules/.bin/webpack: not found

标签: ruby-on-railsherokuwebpackwebpacker

解决方案


安装 heroku/nodejs heroku buildpack。


推荐阅读