【问题标题】:Sprockets::FileNotFound: couldn't find file 'jquery-ui' with type 'text/scss' when deploying a Rails 6 app to HerokuSprockets::FileNotFound: 将 Rails 6 应用程序部署到 Heroku 时找不到类型为“text/scss”的文件“jquery-ui”
【发布时间】:2021-08-27 11:42:33
【问题描述】:

我正在努力将我的 Rails 6 应用程序部署到 Heroku - 部署因以下错误消息而中断:

remote:        rake aborted!
remote:        Sprockets::FileNotFound: couldn't find file 'jquery-ui' with type 'text/scss'
remote:        Checked in these paths:
remote:          /tmp/build_510d92ed/app/assets/config
remote:          /tmp/build_510d92ed/app/assets/images
remote:          /tmp/build_510d92ed/app/assets/javascripts
remote:          /tmp/build_510d92ed/app/assets/stylesheets

这是我的app/assets/config/manifest.js

//= link_tree ../images
//= link_directory ../javascripts .js
//= link application.scss
//= link custom.css
//= link vendor/slick.min.js

并且是app/assets/stylesheets/application.scss 文件:

/*
 *= require_self
 *= require jquery-ui
 */
 @import 'custom';

package.json:

{
  "name": "myapp",
  "private": true,
  "dependencies": {
    "@hotwired/turbo-rails": "^7.0.0-beta.5",
    "@rails/actioncable": "^6.0.0",
    "@rails/activestorage": "^6.0.0",
    "@rails/ujs": "^6.0.0",
    "@rails/webpacker": "5.2.1",
    "@tailwindcss/forms": "^0.3.2",
    "@tailwindcss/postcss7-compat": "^2.0.4",
    "autoprefixer": "^9",
    "el-transition": "^0.0.7",
    "google-maps": "^4.3.3",
    "jquery": "^3.6.0",
    "postcss": "^7",
    "stimulus": "^2.0.0",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat"
  },
  "version": "0.1.0",
  "devDependencies": {
    "webpack-dev-server": "^3.11.2"
  }
}

我该如何解决这个问题?

提前谢谢你。

【问题讨论】:

  • 您的package.json 中有jquery-ui 吗?
  • 不,没有 - 我将整个 package.json 添加到 OP。
  • 所以在本地运行yarn add jquery-ui,顺便说一句,如果你使用sprockets,那么你可以使用这个gem:github.com/jquery-ui-rails/jquery-ui-rails

标签: ruby-on-rails heroku sprockets rails-sprockets


【解决方案1】:

我的解决方案是运行yarn install。有时是小事。

【讨论】:

    【解决方案2】:

    对我来说,升级到 rails 7 后,我需要添加链轮,就像这样,然后一切正常:

    # Gemfile
    gem "sprockets-rails"
    

    更多here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-21
      • 1970-01-01
      • 2018-03-18
      • 2021-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多