feh ERROR: Can't open X display [Mac]
MacからラズパイにSSHで接続して、
USBカメラで撮影した画像を feh
コマンドで表示しようとするとエラーが出る。
$ feh ./image.jpg feh ERROR: Can't open X display. It *is* running, yeah?
これ、前も見たことあるエラーだな。
ググってあれこれ探した結果、MacではXQuartzを入れれば解決する事がわかった。
解決策
- XQuartzをインストールする。
- Macを再起動する
- terminalからラズパイに-Xを付きでssh接続する
ssh -X pi@raspberrypi.local
(-X でMacのXQuartzが起動する) - fehコマンドで画像を開くと… 画像が見れた!
参考リンク
やいまふにWeb版を公開
やいまふにWeb版を公開した。
八重山諸島を結ぶ離島船の運行情報を簡単にチェック。
安栄観光、八重山観光フェリー、石垣ドリーム観光に対応。
また、船の運行を左右する風や波などの天気情報も確認できる。
開発の話をすると、
- Vuejsフレームワーク
- Materializecssでスタイルを作成
- API周りはFirebase Realtime Database
- 公開サーバーはFirebase Hosting
初めて公開できるWebサイトを作った。
初めてのデザインや慣れないJavascriptなど、学ぶべき事が多すぎて苦労したが、
どうにか公開できてホッとしている。
この達成感こそプログラマーの醍醐味だよね
Error: Error parsing triggers: Cannot find module 'firebase-functions'
事象
久々にfirebase Hostingにdeployしようとしたらエラーが出てデプロイできない。
$ firebase deploy === Deploying to 'my-app'... i deploying database, functions, hosting ✔ database: rules ready to deploy. i functions: ensuring necessary APIs are enabled... i runtimeconfig: ensuring necessary APIs are enabled... ✔ runtimeconfig: all necessary APIs are enabled ✔ functions: all necessary APIs are enabled i functions: preparing functions directory for uploading... Error: Error parsing triggers: Cannot find module 'firebase-functions' Try running "npm install" in your functions directory before deploying.
firebase-functionsが無いぜ!npm installしてね、というメッセージ内容。
1ヶ月前までfirebase deployで何事もなくデプロイできていたのに!
解決方法
functionsというディレクトリの中にpackage.jsonがあったので、これをインストールしればいいらしい。
つまり、functionsディレクトリ内で npm install
するだけ。
$ cd functions $ npm install ...
インストール完了後に再度デプロイしてみると
$ firebase deploy ... ✔ Deploy complete!
デプロイ成功!
log4phpでエラー「Call to undefined function simplexml_load_file」in CentOS
PHP7.0をremiコマンドでインストール済みのCentOSで、log4phpを設置する事になった。
しかし、log4phpのconfig.xmlを読み込むところでエラーが吐かれた。
Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() in log4php/configurators/LoggerConfigurationAdapterXML.php:87
simplexml_load_fileが無いと申しておる。
ならば、xmlを読み込むモノを入れようではないか。
$ yum install php-xml
するとズラズラとログが流れるが、最後にエラーの文字が
Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * epel: ftp.riken.jp * remi-safe: mirror.smartmedia.net.id Resolving Dependencies --> Running transaction check ---> Package php-xml.x86_64 0:5.4.16-42.el7 will be installed --> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.4.16-42.el7.x86_64 --> Running transaction check ---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed ---> Package php-xml.x86_64 0:5.4.16-42.el7 will be installed --> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-xml-5.4.16-42.el7.x86_64 --> Finished Dependency Resolution Error: Package: php-xml-5.4.16-42.el7.x86_64 (base) Requires: php-common(x86-64) = 5.4.16-42.el7 Installed: php-common-7.0.15-1.el7.remi.x86_64 (@remi-php70) php-common(x86-64) = 7.0.15-1.el7.remi Available: php-common-5.4.16-42.el7.x86_64 (base) php-common(x86-64) = 5.4.16-42.el7 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
最後のエラー文を抜粋すると
Error: Package: php-xml-5.4.16-42.el7.x86_64 (base) Requires: php-common(x86-64) = 5.4.16-42.el7 Installed: php-common-7.0.15-1.el7.remi.x86_64 (@remi-php70) php-common(x86-64) = 7.0.15-1.el7.remi Available: php-common-5.4.16-42.el7.x86_64 (base) php-common(x86-64) = 5.4.16-42.el7 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
なぜか
php-xml-5.4.16-42.el7.x86_64 (base)
という古いバージョンをインストールしようとして
php-common(x86-64) = 5.4.16-42.el7が必要、と出てるが
既に最新の php-common-7.0.15-1.el7.remi.x86_64 (@remi-php70)
が入っている申しておる。
こういう時はオプションを付けて、remiリポジトリに向けると解決するらしい。
$ yum install --enablerepo=remi php-common php-xml
インストールログはないけど、log4phpが動作するようになった。
めでたしめでたし
ラズパイでUSBカメラから撮影した画像をSlackに投稿
装着
こいつを買った。
LOGICOOL C270
まずはラズパイにUSBカメラを指してlsusb
pi@raspberrypi:~ $ lsusb Bus 001 Device 005: ID 174c:5106 ASMedia Technology Inc. Transcend StoreJet 25M3 Bus 001 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270 Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270
これがUSBカメラのようだ
認識OK
カメラ動作確認
fswebcamインストール
fswebcamとはwebカメラで撮影してファイル保存するコマンドらしい
aptでインストール
sudo apt-get install fswebcam
撮影実行
fswebcam image.jpg
デフォルトだと画像が小さくバナーが下部に出るのでオプションを付ける
fswebcam -r 1280x720 --no-banner image.jpg
fehインストール
撮ったはいいが、CLIで表示できないので、fehをインストールする。
fehとは昔から有名な軽量の画像ビューワらしい
fehインストール
sudo apt-get install feh
表示するには
feh image.jpg
使用していると
feh ERROR: Can't open X display. It *is* running, yeah?
とエラーがでて画像が表示されなくなった。
ctrl + Dでログアウトすると直ったが、よく分からん。
fim というビューワーをオススメしているサイトも見た。
Slackに投稿
homeからPictures/image.jpg をtestチャンネルにアップロードする
curl -F file=@Pictures/image.jpg -F channels=test -F token=xxxx-xxxxxxx-xxxxxxxxxxx-xxxxx https://slack.com/api/files.upload
無事に投稿できたー
npm install -gでError: EACCES: permission denied
npm installで-gをつけたグローバルオプション指定時にエラーがでた時の対処法
今日、firebase-toolsをインストールしようとした。
npm install -g firebase-tools
すると以下のメッセージが表示された。
npm ERR! { [Error: EACCES: permission denied, unlink '/usr/local/lib/node_modules/firebase-tools/LICENSE'] npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'unlink', npm ERR! path: '/usr/local/lib/node_modules/firebase-tools/LICENSE' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! error rolling back Error: EACCES: permission denied, unlink '/usr/local/lib/node_modules/firebase-tools/LICENSE' npm ERR! error rolling back at Error (native) npm ERR! error rolling back { [Error: EACCES: permission denied, unlink '/usr/local/lib/node_modules/firebase-tools/LICENSE'] npm ERR! error rolling back errno: -13, npm ERR! error rolling back code: 'EACCES', npm ERR! error rolling back syscall: 'unlink', npm ERR! error rolling back path: '/usr/local/lib/node_modules/firebase-tools/LICENSE' }
パーミッションエラーとなってしまった。
sudo を付ければインストールできるけども危険な方法らしい。
こんな時はグローバルモジュールのパーミッション変更を行う
mkdir ~/.npm-global npm config set prefix '~/.npm-global'
あとは.bashrcに以下を追加
export PATH="$HOME/.npm-global/bin:$PATH"
その後にsource .bashrcして
source .bashrc
npmを-gでインストールしなおして
npm install -g npm
sudoを付けるにfirebase-toolsをインストールしてみると
npm install -g firebase-tools
無事にインストールできましたー
風が吹く
人の世に吹く風が人の姿を作る。 自分の周りを吹く風が自分を作る。 その風が変わるとき、人も自分も変わらねばならない。 風、吹いた。