redmine構築時に出たエラー

誰にも報告する機会もなさそう&似たような記事が見つからないからここに買いとこう

DBのredmine用マイグレーション
su – user
bundle install --without development test rmagick
 →withoutが非推奨とのアラート
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'development test rmagick'`, and stop using this flag
There was an error while trying to write to `/usr/local/redmine/.bundle/config`. It is likely that you need to grant write
permissions for that path.

対応方法:
・pathを明示的に指定する
bundle config set path 'vendor/bundle'
・withoutしたいやつは事前に書き込んでおく
bundle config set --local without 'development test rmagick'
・いよいよインストール
bundle install
なかなか気を使いますねー
★この時、「loofah 2.21.1」が入ってしまう…

bundle exec rake generate_secret_token
すると、このコマンドで
Nokogiri::HTML (NameError)
が出て終わらない…

loofahを入れなおしてみる
アンインストールコマンド
bundle exec gem uninstall loofah
[hoge@localhost redmine]$ bundle exec gem uninstall loofah

You have requested to uninstall the gem:
loofah-2.21.1

rails-html-sanitizer-1.5.0 depends on loofah (~> 2.19, >= 2.19.1)
If you remove this gem, these dependencies will not be met.
2.19.1を入れなおすつもりなので、消しちゃって!おっけ!

なんか個別には制御できなさそう?(あまり詳しかない)ので、Gemfileでバージョンを制御する
cp -pi Gemfile Gemfile.20230711
vi Gemfile
この行を追加
gem “loofah”, “~>2.19.1”
場所は…深い意味はないがroadie-railsの下にした
bundle install
よしよし、指定のバージョンが入ったな
Fetching loofah 2.19.1 (was 2.21.1)
Installing loofah 2.19.1 (was 2.21.1)

満を持して
bundle exec rake generate_secret_token
無事終わったーーーー

参考:
ありがとうございます!!
https://www.ruby-forum.com/t/i-am-using-ruby-version-2-3-8-and-rails-version-5-2-6-to-develop-my-application-since-yesterday-i-am-getting-the-error-i-tried-to-find-the-occurrence-of-this-nokogiri-html4-in-my-application-but-i-didnt-find-any-of-the-occurrence-like-this/263852/5
問題を起こしているのはloofahのgemで、バージョンアップしたのに依存を直してないんちゃうかみたいなことが書いてありますね

bundle exec rake redmine:plugins:migrate
エラー
Could not find gem 'activerecord-compatible_legacy_migration' in locally installed gems.
これはbundle installすると拾ってくる
bundle exec rake redmine:plugins:migrate

次のエラー

ActiveRecord::AdapterNotSpecified: ‘development’ database is not configured. Available: [“production”]

dev無いとダメなのか?

明示的にproductionあてにしてみる!
bundle exec rake redmine:plugins:migrate RAILS_ENV=production

通った!

コメント

タイトルとURLをコピーしました