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セットアップ
# とりあえずパッケージアプデ sudo apt update sudo apt upgrade # ライブラリ系 sudo apt-get install -y libnss3-dev libatk1.0-0 libatk-bridge2.0-0 libcups2-dev libxkbcommon.so.0 libgbm-dev libgtk-3-0 libmysqlclient-dev imagemagick libmagickwand-dev mysql-client sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig # https://qiita.com/mtsgi/items/8a844870f30b30ef21e4#fluent-terminal sudo apt install build-essential curl file # Linux brew sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv) test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" # git brew intall git git config --global user.name 'akinov' git config --global user.email 'メアド' # zsh brew install zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions # peco brew install peco # rbenv brew install rbenv sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev rbenv install 2.6.6 rbenv global 2.6.6 rbenv rehash # nodenv brew install anyenv echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.zshrc echo 'eval "$(anyenv init -)"' >> ~/.zshrc eval "$(anyenv init -)" anyenv install --init anyenv install nodenv exec $SHELL -l nodenv install 15.12.0 nodenv global 15.12.0 # pg sudo apt install postgresql sudo apt install libpq-dev brew install imagemagick
chromedriverインストール
.zshrc
関係
HISTFILE=$HOME/.zsh-history HISTSIZE=1000000 SAVEHIST=1000000 # 同時に起動したzshの間でヒストリを共有する setopt share_history # 直前と同じコマンドの場合は履歴に追加しない setopt hist_ignore_dups # 同じコマンドをヒストリに残さない setopt hist_ignore_all_dups # スペースから始まるコマンド行はヒストリに残さない setopt hist_ignore_space # ヒストリに保存するときに余分なスペースを削除する setopt hist_reduce_blanks autoload -Uz colors ; colors setopt no_beep setopt nolistbeep setopt auto_pushd autoload -Uz compinit ; compinit` # alias alias g='git' alias rs='rails s' alias rs4='rails s -p 4000' alias rc='rails c' alias cre='rails db:create' alias mig='rails db:migrate' alias rol='rails db:rollback' alias seed='rails db:seed' alias drop='rails db:drop' alias rr='rake routes' alias be='bundle exec' alias bi='bundle install' alias pbcopy='clip.exe' alias dc='docker-compose' eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" # peco function peco-history-selection() { BUFFER=`history -n 1 | tac | awk '!a[$0]++' | peco` CURSOR=$#BUFFER zle reset-prompt } zle -N peco-history-selection bindkey '^R' peco-history-selection # rbenv eval "$(rbenv init -)" # anyenv export PATH="$HOME/.anyenv/bin:$PATH" export PATH="$HOME/.anyenv/bin:$PATH" # nodenv eval "$(nodenv init -)"
.gitconfig
[core] autocrlf = false ignorecase = false editor = vi [color] ui = true [pull] ff = only [alias] ps = push pl = pull co = checkout br = branch cm = commit st = status last = log -1 HEAD sw = switch swc = switch -c delete-merged-branch = !git branch --merged | egrep -v '\\*|master|release' | xargs git branch -d [fetch] prune = true [push] default = simple [pager] branch = false
エイリアス参照 【.zshrc解説】コピペで簡単zshカスタマイズ【設定方法】
環境構築で参照 WSL2でWeb開発環境の構築メモ (zsh, node, dockerなど)
anyenv系で参照 WSL2 + VScode + nodenv(anyenv)の環境構築方法まとめ - Qiita
rmagikインストールで参照
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 mimemagic (0.3.5) has removed it. You'll need to update your bundle to a version other than mimemagic (0.3.5) that hasn't been removed in order to install.
mimemagic
の指定しているバージョンが yanked
になってしまったよう
対応
bundle update
してバージョンアップ
bundle update minemagic
WSL2に立てたサーバーに同ネットワークにある別端末からアクセスする
WSL上で開発をしていて立てたサーバーに別端末からアクセスする方法です。
Macでは何もせずにアクセスできたのですが、WSLの場合、Windows側にポートフォワーディングを設定する必要があります。
WSLのIPを調べる
ifconfig
で確認
172.21.171.162
の部分
$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.21.171.162 netmask 255.255.240.0 broadcast 172.21.175.255 inet6 fe80::215:5dff:fe53:6719 prefixlen 64 scopeid 0x20<link> ether 00:15:5d:53:67:19 txqueuelen 1000 (イーサネット) RX packets 25699 bytes 10913242 (10.9 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4954 bytes 2993879 (2.9 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (ローカルループバック) RX packets 109531 bytes 128195327 (128.1 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 109531 bytes 128195327 (128.1 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
PowerShellでポートフォワーディングを設定
※管理者として実行してください
$ netsh interface portproxy add v4tov4 listenport=3000 connectaddress=[先程調べたIP]` $ netsh interface portproxy add v4tov6 listenport=3000 connectaddress=::1
※ 2022/01/05 IP周りの設定が変わったのかアクセスできなくなっていたので v4tov6 周りの設定を追加 matsudamper.hatenablog.com
設定されているポートフォワーディングは
netsh interface portproxy show v4tov4
netsh interface portproxy show v4tov6
で確認可能
PS C:\WINDOWS\system32> netsh interface portproxy add v4tov4 listenport=3000 connectaddress=172.21.171.162 PS C:\WINDOWS\system32> netsh interface portproxy add v4tov6 listenport=3000 connectaddress=::1 PS C:\WINDOWS\system32> netsh interface portproxy show v4tov4 ipv4 をリッスンする: ipv4 に接続する: Address Port Address Port --------------- ---------- --------------- ---------- * 3000 172.21.171.162 3000
PostgreSQLでdatabaseをReadOnlyに設定する
default_transaction_read_only
を on
に設定する
alter database database_name set default_transaction_read_only = on;
その他メモ
レプリカのDBを作ってReadOnlyに設定する手順
現行DBのexport
pg_dump database_name > import.sql
レプリカへのインポート
psql replica_database_name < import.sql
ReadOnlyに設定
alter database replica_database_nameset default_transaction_read_only = on;