このページで分かること
n での切り替え以下のコマンドでyarnを入れるとうまく動作しない
Ubuntu 18.04 の apt にある yarn は cmdtest という別ツールで、Yarn Classic とは別物だ。引数なしで叩くと There are no scenarios で落ちる。GROWI が使う yarn は本家リポジトリのものなので、必ず入れ直す。
前提・必要なもの
node_modules とビルド成果物でかなり食うので、実用上は 32GB 以上が安心だ。yarn)と起動(npm start)を同じ機体で同時に走らせない。スワップを 2〜4GB 確保しておくと安定する。user@Jetson $ sudo apt-get install yarn
実行するとこうなる。
00h00m00s 0/0: : ERROR: There are no scenarios; must have at least one.
一度アンインストール
user@Jetson $ sudo apt remove yarn
入れ直す。
user@Jetson $ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
user@Jetson $ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
user@Jetson $ sudo apt update && sudo apt install yarn
これで大丈夫。
公式手順通りに。
user@Jetson $ cd /opt
user@Jetson $ sudo git clone https://github.com/weseek/growi
user@Jetson $ cd growi
user@Jetson $ sudo git tag -l
user@Jetson $ sudo git checkout -b v3.5.9 refs/tags/v3.5.9
user@Jetson $ sudo yarn
するとエラーが。以下ログ
yarn install v1.19.1
[1/5] Validating package.json...
error growi@3.5.17-RC: The engine "node" is incompatible with this module. Expected version ">=8.11.1 <11". Got "8.10.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
user@Jetson $
nodeのバージョンが古いらしい。
Node.js 側の要件は >=8.11.1 <11。Ubuntu 18.04 の apt に入る nodejs は 8.10.0 で、この条件を満たさない。n で stable(当時は v10.16.3)へ切り替えるのがこの節の肝だ。n stable の後は exec $SHELL -l か再ログインをしないと PATH が古いままで、node -v が 8.10.0 のままに見えることがある。
user@Jetson $ sudo apt install -y nodejs npm
user@Jetson $ sudo npm install n -g
user@Jetson $ sudo n stable
user@Jetson $ sudo apt purge -y nodejs npm
user@Jetson $ exec $SHELL -l
入れ終わった段階で再度ログインし再度確認。
user@Jetson $ node -v
v10.16.3
user@Jetson $
これでOK。再度実行。
user@Jetson $ sudo yarn
Done in 628.92s.
user@Jetson $
10分くらいかな?
動作確認
ここでの動作確認はフォアグラウンド起動だ。npm start したターミナルを閉じると止まる。MONGO_URI / ELASTICSEARCH_URI を渡しているのは、この版が接続先を環境変数で受けるため。http://xxx.xxx.xxx.xxx:3000/ で繋がらないときは、Jetson 側で ss -lntp | grep 3000 を見て待ち受けているか確かめる。
user@Jetson $ cd /opt/growi
user@Jetson $ sudo MONGO_URI=mongodb://localhost:27017/growi ELASTICSEARCH_URI=http://localhost:9200/growi npm start
プラグイン"lsx"のインストール
user@Jetson $ cd /opt/growi
user@Jetson $ sudo yarn add growi-plugin-lsx
ブラウザでJetsonそのものからアクセスするなら"http://localhost:3000"、ネットワーク経由なら"http://xxx.xxx.xxx.xxx:3000/"にアクセス。

起動が確認できたのでsystemctlで起動できるようにする。
user@Jetson $ sudo nano /etc/systemd/system/growi.service
ファイルの中身。
[Unit]
Description=Growi
After=network.target mongod.service
[Service]
WorkingDirectory=/opt/growi <-ここと
EnvironmentFile=/etc/sysconfig/growi <-ここと
ExecStart=/usr/local/bin/npm start <-ここを確認。
[Install]
WantedBy=multi-user.target
npmの場所は
user@Jetson $ npm bin -g
で調べられる。
次に、"/etc/sysconfig/growi"を作成。
user@Jetson $ sudo nano /etc/sysconfig/growi
中身はこんな感じ。ほぼインストールのデフォルト状態。
PASSWORD_SEED の行はバッククォートの対応が崩れているので、実際には openssl rand -base64 128 | head -1 の実行結果(ランダム文字列)をそのまま貼る。ここが空だと本番モードで起動に失敗する。REDIS_URL は同じ Redis でも DB を分けたいなら .../6379/1 のように末尾の番号を変える(GROWI は既定で growi という DB 名を使う)。
PORT=3000
MODE_ENV=production
PASSWORD_SEED="openssl rand -base64 128 | head-1`"
MONGO_URI="mongodb://localhost:27017/growi"
REDIS_URL="redis://localhost:6379/growi"
ELASTICSEARCH_URI="http://localhost:9200/growi"
FILE_UPLOAD=local
Growiをサービス起動。
user@Jetson $ systemctl restart growi.service
user@Jetson $ systemctl status growi.service
大丈夫そうなら自動起動を設定。
user@Jetson $ systemctl enable growi.service
自動起動の設定ができているかどうかは以下のコマンド。
enabled と出れば次回起動から自動で上がる。systemctl status growi.service が active (running) でもブラウザで開けない場合は journalctl -u growi.service -n 50 で起動ログを見る。MongoDB や Redis が先に上がっていないと接続エラーで落ちるので、After= の依存が効いているかも確認する。
user@Jetson $ systemctl is-enabled growi.service
ERROR: There are no scenarios; must have at least one.: apt の yarn が cmdtest を指している。本家 yarn を入れ直す。The engine "node" is incompatible with this module: Node.js が古い。node -v が 10 系か確認する。ログインシェルを開き直していないと PATH が古いままだ。yarn が Killed で落ちる: メモリ不足。4GB の Nano では重い。スワップを増やすか、他のプロセスを止めてから実行する。ss -lntp)と /etc/sysconfig/growi の PORT を見る。ネットワーク越しなら Jetson の IP を確認する。systemctl is-enabled growi.service が enabled か、journalctl -u growi.service にエラーが出ていないかを見る。Q. なぜ apt の yarn ではダメなのか?
A. Ubuntu の apt パッケージ名 yarn は cmdtest という別ツールで、Node のパッケージマネージャではない。yarn --version がエラーになるならそれが原因だ。
Q. Node.js は何を入れればいい?
A. この版(GROWI 3.5.9)は >=8.11.1 <11。当時は n stable で v10.16.3 が入った。今から組むなら公式の Docker 構成に逃げるのが早い。
Q. MongoDB / Redis / Elasticsearch は必須か?
A. この版は3つとも接続先が要る。1つでも落ちていると起動しない。systemctl status で3つとも active (running) を確認してから GROWI を起動する。
Q. yarn に10分かかるのは普通か?
A. この機体では普通。Done in 628.92s(約10分)の実績がある。aarch64 の 4GB ではビルドが遅い。
※ 本ページのAmazonリンクにはアフィリエイトタグ(toobf6-22)が付いている。
🤖 このページにはAIエージェント(ノア)による編集・加筆が含まれます。内容の正確性は保証できないため、重要な判断は一次情報でご確認ください。