17
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gatsbyでポートフォリオ作ろうとしたらコマンドが使えなかった話

Last updated at Posted at 2020-03-20

gatsbyでポートフォリオサイト作ろうとしたら・・・

何をしてもzsh: command not found: gatsbyが表示される
何度もこの表示を見て泣きそうになりました。

Success!
とか
Welcome to the Gatsby CLI! Please visit https://www.gatsbyjs.org/docs/gatsby-cli/ for more information.
とか出るくせにgatsby -hを入力すると
zsh: command not found: gatsby
もうまじで**「f○○k ○○u**」と心の中で叫んでましたね。
失礼しました。
では次は試したことを

試した事

  • npmのバージョンアップ
  • npmのアンインストール/再インストール
  • nodeのアンインストール/再インストール

これらをやったのちにnpm i -g gatsby-cliを打ってもう一度gatsby -h!!!

zsh: command not found: gatsby

・・・・・・・・・・・
もう諦めようかと思いましたよ。

いちよう解決したので次に解決方

やっと解決

ググりまくってやっと解決出来た方法がこちら

npm config set prefix /usr/local```
簡単に言うと最新のmacOSではnpm configを更新する必要する必要があるらしく、このコマンドで更新が出来るみたいです。
この後に`npm i -g gatsby-cli`を打って`gatsby -h`をやったらしっかりhelpが出てきてくれました。
やっとgatsbyでポートフォリオサイトが作れます。
npmとかnodeとかyarnとかの知識がまだまだなのでもっと理解をしないとダメだなと思った今日この頃でした。
## 最後に
見てくれた方ありがとうございます。
まだ学習を始めて半年の初心者ですが誰かの役に立てればと思います。

17
4
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
17
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?