結論
プロジェクトのディレクトリに移動して npm install --save gatsby
すると良いでしょう。issue あげたら npm の問題であるとの事ですが、gatsby 側からは特に対応しないようです。とはいえ tutorial 試して見て動かないから使うのやめた、という人達が出てきてしまう気がするのでちょっと気になる。まあ Gatsby.js が結構バギーな状態の気がするので初学者が何かするにはそもそも敷居が高い気がするのでしょうがないのかな。*1
問題
I tried Gatsby.js Tutorial Part Two but I found the error message.
環境
% node -v v8.1.0 % sw_vers ProductName: Mac OS X ProductVersion: 10.12.6 BuildVersion: 16G29
再現方法
I typed the following commands.
% cd % npm install --global gatsby-cli % gatsby --version 1.1.6 % gatsby new tutorial-part-two https://github.com/gatsbyjs/gatsby-starter-hello-world % cd tutorial-part-two
At this point, I can run the gatsby develop
. But I found the error message when I create the gatsby-config.js
.
% cat << EOT > gatsby-config.js module.exports = { plugins: ["gatsby-plugin-typography"], } EOT
% npm install --save gatsby-plugin-typography
the error
% npm run develop > gatsby-starter-hello-world@ develop /Users/okamuuu/tutorial-part-two > gatsby develop success open and validate gatsby-config.js — 0.005 s (node:76343) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Unable to find plugin "gatsby-plugin-typography" (node:76343) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
解決策?
Looks like node_modules/gatsby
is almost empty.
% ls -al node_modules/gatsby total 0 drwxr-xr-x 3 okamuuu staff 102 9 1 23:51 . drwxr-xr-x 94 okamuuu staff 3196 9 1 23:51 .. drwxr-xr-x 3 okamuuu staff 102 9 1 23:51 node_modules
So I tried to type npm install --save gatsby
. It looks good to me.
% ls node_modules/gatsby/ README.md cache-dir node_modules yarn.lock bin dist package.json
*1:個人的には結構気に入っていて最近ずっと触っています