いくつかの環境下でのgitbook
gitbookを試してうまく行ったりしなかったりしたので,どこで詰まったかを書いておく.
やりたかったことは,
- npm で gitbook-cliのインストール
- gitbook initでgitbookのダウンロード
- book.jsonを作成し,pluginとしてmathjaxを追加
- gitbook installでbook.jsonを参照してmathjaxをインストール
- gitbook serveでlocalhost:4000を公開しプレビュー.最悪gitbook buildができればいい.
前提としてnodejs v4をインストール済みとする.
またwindowsにはVisualstudio2015とC++をインストール済みである.
Ubuntu 14.04
すべてうまくいった
CentOS7 (Windows10のVirtualBox上)
mathjaxのインストールに成功したが,
サーバがlocalhostなため,ホストコンピュータからアクセスできない.
railsとかなら--bind=0.0.0.0でいけるんだが,それに相当するオプションが見つからなかった.
Bash on windows (Ubuntu)
mathjaxのインストールもできたが,サーバが起動しない.
$ gitbook serve Error: watch /mnt/c/gitbook/book.json EPERM
Windows10
サーバの起動まではいったが,mathjaxのインストールに失敗.
$ gitbook install このソリューション内のプロジェクトを 1 度に 1 つずつビルドします。並行ビルドを有効にするには、"/m" スイッチを追加してく ださい。 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(219,5): error M SB4175: タスク ファクトリ "CodeTaskFactory" をアセンブリ "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Build.Tasks.Core.dll" から読 み込めませんでした。プロセスを開始するのに使用される環境ブロックの長さは、65,535 バイトを超えて指定することはできません 。 ユーザーの環境ブロックの長さは 1861438 バイトです。 環境変数のいくつかを削除して、もう一度実行 してください。 [C:\gitbook\node_modules\contextify\build\contextify.vcxproj] Error: contextify@0.1.15 install: `node-gyp rebuild` Exit status 1
contextifyをnpmでインストールすることを試みるも失敗.
npm install contextify このソリューション内のプロジェクトを 1 度に 1 つずつビルドします。並行ビルドを有効にするには、"/m" スイッチを追加してください。 contextify.cc win_delay_load_hook.c C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNot ifyHook2': redefinition; different type modifiers [C:\gitbook\node_modules\contextify\bu ild\contextify.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: see declaration of '__pfnDliNot ifyHook2' gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\gitbook\node_modules\contextify gyp ERR! node -v v4.4.7 gyp ERR! node-gyp -v v3.3.1 gyp ERR! not ok npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "contextify" npm ERR! node v4.4.7 npm ERR! npm v2.15.8 npm ERR! code ELIFECYCLE npm ERR! contextify@0.1.15 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the contextify@0.1.15 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the contextify package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs contextify npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm ERR! npm owner ls contextify npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! C:\gitbook\npm-debug.log