在部署到Heroku ROR项目期间,我收到错误消息"预编译assets资源 失败".

我试图找到带有"calc(100vh-110px)"的css代码,但在项目中没有找到任何东西.

这可能是什么问题呢?谢谢

remote: -----> Installing node-v20.9.0-linux-x64
remote: -----> Installing yarn-v1.22.19
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.22.19
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote:        warning " > webpack-dev-server@3.11.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        [4/4] Building fresh packages...
remote:        Done in 15.09s.
remote:        rake aborted!
remote:        SassC::SyntaxError: Error: "calc(100vh - 110px)" is not a number for `min'
remote:                on line 1:30534 of stdin, in function `min`
remote:                from line 1:30534 of stdin
remote:        >> x;flex:1;flex-direction:column;max-height:min(650px,calc(100vh - 110px));ove
remote:           ------------------------------------------^
remote:        stdin:1

我try 运行rails assets:precompile:

    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:22: warning: previous definition of SAME_PATHS was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant Pathname::SEPARATOR_PAT
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:35: warning: previous definition of SEPARATOR_PAT was here
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:41: warning: previous definition of ABSOLUTE_PATH was here
    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
    Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
    /Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
    /Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
    yarn install v1.22.15
    warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
    [1/4] 🔍  Resolving packages...
    success Already up-to-date.
    ✨  Done in 0.15s.
    Warning: you are using an unstable release of Node.js (v21.2.0). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node
    Everything's up-to-date. Nothing to do

我还try 了:RAILS_ENV=Production Rails Assets:预编译

olegmishyn@MacBook-Air-Oleg learnician % RAILS_ENV=production rails assets:precompile SECRET_KEY_BASE='07788fabf3594bf7c2d898acfd331bb39294bb613c2609e9d2966cd5593a3cb0131be5ce5165de67a10f24ade4bf45e5d74e80104beb79404f0f441b93e46eff'

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:22: warning: previous definition of SAME_PATHS was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant Pathname::SEPARATOR_PAT
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:35: warning: previous definition of SEPARATOR_PAT was here
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/pathname-0.2.1/lib/pathname.rb:41: warning: previous definition of ABSOLUTE_PATH was here
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/olegmishyn/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/set.rb:648: warning: already initialized constant Set::InspectKey
/Users/olegmishyn/.rvm/gems/ruby-3.0.0/gems/set-1.0.3/lib/set.rb:815: warning: previous definition of InspectKey was here
yarn install v1.22.15
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.15s.
rails aborted!
SassC::SyntaxError: Error: "calc(100vh - 110px)" is not a number for `min'
        on line 1:30534 of stdin, in function `min`
        from line 1:30534 of stdin
>> x;flex:1;flex-direction:column;max-height:min(650px,calc(100vh - 110px));ove
   ------------------------------------------^

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

推荐答案

已通过以下方法修复该问题:将config.assets.css_compresers=nil添加到Applation.rb和Production.rb,并在Package.json中将node.js版本更改为"Engines":{"node":"16.13.1"}

Ruby-on-rails相关问答推荐

`heroku Open`和`heroku run rake db:Migrate`不工作(";没有这样的文件或目录";)

我使用rbenv安装Ruby,但我在使用";gem";->;错误:执行gem时遇到此错误.(Errno::EACCES)权限被拒绝

ActiveAdmin:的呈现索引表在父级的显示页中有许多资源

从Rails中的字符串中间提取子字符串

根据表单内的 Select 字段值渲染部分内容

获取所有属于模型的嵌套对象

如何使用 Rails 语义记录器记录整个请求(标头、正文等)

您如何测试方法调用块内调用的方法,以及使用 rspec 在块内传递给该方法调用的内容

只允许用户在 Rails 中输入字母和数字

Rails 控制台 - 更新 Gem 后的弃用通知

您如何查看在 Rails 中触发回调的关联模型?

Selenium chromedriver:无法从不可键入的键构造KeyEvent

Rails 3 应用程序的 MySQL 集群 (NDB) 与 MySQL 复制 (InnoDB):优点/缺点?

Rails 3 - Select 包含?

在 Windows 上使用 Ruby 进行开发

在 Controller 中调用模型方法

Rails 3. 构建 oauth2 提供程序

Rails 4 pgsql add_index 类型为 GIN 或 GiST

您将 Rack 中间件文件和要求放在哪里?

您推荐哪些工具来分析 Rails 应用程序?