Hexoのインストール

メモを残すためのツールとして,Static Site Generatorの
ブログフレームワーク “Hexo” を始めてみることにした

A fast, simple & powerful blog framework
https://hexo.io/

インストールしたplatformは,Debian Linux 10である.
作業として行ったことは,大きく2つ

  1. gitのインストール
    これはDebian 10のpackageを素直にインストールした

  2. hexoのインストール
    以下のWebページを参照しつつ,そのまま実行した
    Hexo install: https://hexo.io/docs/#Install-Hexo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ npm install hexo-cli -g
((大量のエラー発生))

npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/hexo-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/lib/node_modules'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/lib/node_modules'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-03-07T09_44_36_818Z-debug.log

エラーメッセージを見るに,/usr/lib配下のファイルへのアクセス権限がないという
ことなので,sudoを使いrootユーザ権限で実行し直した
また,最初に方に表示されている fsevents 系のWARN はnpmの不具合(?)らしい
参照: https://stackoverflow.com/questions/46929196/how-to-solve-npm-install-throwing-fsevents-warning-on-non-mac-os

(注意)
あとで気づいたのが,rootユーザやsudoでこの問題を解決しない方が良いらしい
Install Node.js - Mac / Linux
https://hexo.io/docs/#Install-Node-js
Resolving EACCES permissions errors when installing packages globally
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

1
2
3
4
5
6
7
8
$ sudo npm install hexo-cli -g
[sudo] password for user:
/usr/bin/hexo -> /usr/lib/node_modules/hexo-cli/bin/hexo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/hexo-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ hexo-cli@3.1.0
added 74 packages from 319 contributors in 5.828s

で,無事にインストールが終わったように見える

念の為,インストールされたものを確認する

1
2
3
4
$ which hexo
/usr/bin/hexo
$ file /usr/bin/hexo
/usr/bin/hexo: symbolic link to ../lib/node_modules/hexo-cli/bin/hexo

— ends here

Author

T.T

Posted on

2020-03-08

Updated on

2020-12-12

Licensed under