2021-01-01から1年間の記事一覧

Rails ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage

新規のアプリデプロイ時にこんなエラーが -----> Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage /tmp/build_…

Heroku Railsアプリデプロイ時にrake assets:precompileでNoMethodError: undefined method `[]' for nil:NilClass

久しぶりに rails new して Herokuにデプロイした時にエラー -----> Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! NoMethodError: undefined method `[]' for nil:NilClass master.keyをHeroku環境変数に設定する…

rails credentials:editでNo $EDITOR to open file in. Assign one like this:と怒られる

$ rails credentials:edit No $EDITOR to open file in. Assign one like this: EDITOR="mate --wait" bin/rails credentials:edit For editors that fork and exit immediately, it's important to pass a wait flag, otherwise the credentials will be sa…

Rspecで WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives

Rspec実行時に以下で怒られました。 WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. `NoMethod…

Ruby HTTPClientでpostする

簡単なことなんだけどbodyを入れるのがうまくいかず詰まったのでメモ require 'httpclient' require 'json' client ||= ::HTTPClient.new # body を jsonにする必要がある body = JSON.generate({ hoge: { moge: 1234 } }) # railsの場合は to_json で ok he…

docker-compose で Can't separate key from value と怒られた時の対応

Docker for Desktopをアップデートしたら以下のエラーが $ docker-compose run => Can't separate key from value Docker2をデフォルトで使う設定になってしまっているようなのでチェックを外し設定をオフにします。 stackoverflow.com

Rails consoleでrake taskを呼び出す

デバッグやバッチ処理内でRake taskを呼び出したいときの対応 Rails.application.load_tasks Rake::Task['my_task'].execute # 引数を渡す場合 Rake::Task['my_task'].execute('arg_string') Rake::Task['my_task'].execute(hoge: 'moge') my_task には hoge…

WSL Docker Elasticsearchで max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] PowerShellで以下を実行して解決 ❯ wsl --shutdown # because we don't really need to restart the computer to see the config is lost ... ⚡ beccari…

WordPress開発環境をwp-envで簡単に作る

npmの @wordpress/env を使うとメチャクチャ簡単にDockerでWP環境が作れました。 基本的に公式ドキュメント通りに設定するだけです。 ja.wordpress.org @wordpress/env をインストール # グローバルに入れるか npm -g i @wordpress/env # ローカルプロジェク…

GitHub ActionsでXserverにあるWPに自動デプロイを設定する

1.GitHubのSecretsにXserverの秘密鍵を登録する 公式を参考 docs.github.com 2..github/actions/deploy.yml 作成 name: deploy to xserver on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 # 必要…

Don't know how to build task 'active_storage:install'

rails active_storage:install をしようとしたら以下のエラー Don't know how to build task 'active_storage:install' config/application.rb で以下をコメントアウトしているのが原因でした # require "active_storage/engine"

Puppeteerでライブラリ不足 libgbm.so.1

以下のエラー chrome: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory インストールする sudo apt-get install -y libgbm-dev

Puppeteerでライブラリ不足 libxkbcommon.so.0

以下のエラー chrome: error while loading shared libraries: libxkbcommon.so.0: cannot open shared object file: No such file or directory インストールする sudo apt-get install libxkbcommon-x11-0

Puppeteerでライブラリ不足 libraries: libcups.so.2

以下のエラー chromedriver: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory インストールする sudo apt-get install libcups2-dev

Puppeteerでライブラリ不足 libraries: libatk-bridge-2.0.so.0

以下のエラー chromedriver: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory インストールする sudo apt-get install libatk-bridge2.0-0

Puppeteerでライブラリ不足 libraries: libatk-1.0.so.0

以下のエラー chromedriver: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory インストールする sudo apt-get install libatk1.0-0

Puppeteerでライブラリ不足 libraries: libnss3.so

以下のエラー chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory インストールする sudo apt-get install libnss3-dev

個人的Windowsを買ったときのセットアップ

毎回するセットアップのメモ とりあえずインストール Google Chrome Google 日本語入力 半角全角切り替えの設定 Clibor Slack Zoom Microsoft PowerToys CapsLockをCtrlに変換 WSL Ubuntu RubyMine VS Code Docker Desktop WSL Ubuntuセットアップ # とりあ…

Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.5) has removed it. You'll need to update your bundle to a

Railsプロジェクトを動かそうとしたら下記のエラー Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagi…

WSL2に立てたサーバーに同ネットワークにある別端末からアクセスする

WSL上で開発をしていて立てたサーバーに別端末からアクセスする方法です。 Macでは何もせずにアクセスできたのですが、WSLの場合、Windows側にポートフォワーディングを設定する必要があります。 WSLのIPを調べる ifconfig で確認 172.21.171.162 の部分 $ i…

PostgreSQLでdatabaseをReadOnlyに設定する

default_transaction_read_only を on に設定する alter database database_name set default_transaction_read_only = on; postgresqlco.nf その他メモ レプリカのDBを作ってReadOnlyに設定する手順 現行DBのexport pg_dump database_name > import.sql レ…

WARN When using nuxt generate, you should set target: 'static' in your nuxt.config

古いNuxtプロジェクトを nuxt generate したらWarningが出た。 WARN When using nuxt generate, you should set target: 'static' in your nuxt.config Learn more about it on https://go.nuxtjs.dev/static-target nuxt.config.js に target: 'static' と…

WARN mode option is deprecated. Please use ssr: true for universal mode or ssr: false for spa mode and remove mode from nuxt.config

古いNuxtプロジェクトを起動したらWarningが出た。 WARN mode option is deprecated. Please use ssr: true for universal mode or ssr: false for spa mode and remove mode from nuxt.config nuxt.config.js の mode が非推奨になったらしいので書き換える…