LoginSignup
5
3

More than 5 years have passed since last update.

ラズパイにnpmでfirebaseをインストールしようして苦戦した

Last updated at Posted at 2018-06-16

環境

ラズパイ3 + nでnpmインストール済み

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.4 (stretch)
Release:    9.4
Codename:   stretch

$ n --version
2.1.7

npm -v
5.6.0

node -v
v9.10.1

プロジェクト名はfirebase-realtime-database-watcherとします。

やろうとしたこと

firebase-toolsではなくfirebaseの方を入れようとした。

sudo npm i -S firebase

sudo を付けないとエラーになる

sudoを付けても以下が延々と流れてインストールが終わらない

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/pi/dev/firebase-realtime-database-watcher/node_modules/grpc/.node-gyp/9.10.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/dev/firebase-realtime-database-watcher/node_modules/grpc/.node-gyp"
.
.
.
延々とループ

結論

プロジェクトディレクトリをroot権限にする

sudo chown -R root firebase-realtime-database-watcher/

sudo 付けないと可されていない操作ですと怒られます。

node-gypをインストールする

sudo npm i -g node-gyp

これで準備完了

改めてインストール

sudo npm i firebase

無事インストールできた!

備考

firebaseだけインストールしてもfirebase-toolsがないと意味なかったので、結局firebase-toolsもインストールした。

追記

node-gypが必要かと思ってたが改めて作業すると関係なかった
必要でした、node-gypインストールを追加。

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3