LoginSignup
2

More than 5 years have passed since last update.

Windows10でnpm install -g hogeしたものがcommand not foundになる

Last updated at Posted at 2018-10-14

この記事 is 何

Windowsでfirebase-toolsをインストールしたのだけど、なぜかコマンドが存在しないって怒られたときの、私の場合の対処法

原因

Pathが通ってなかった

インストールされたパッケージのPathを通せばOK。

症状とか

以下のようにしてfirebase-toolsをインストール

PS C:\> npm install -g firebase-tools

これでコマンドが使えると思いきや…

PS C:\> firebase
firebase : 用語 'firebase' は、コマンドレット、関数、スクリプト ファイル、または操作可能なプログラムの名前として認識され
ません。名前が正しく記述されていることを確認し、パスが含まれている場合はそのパスが正しいことを確認してから、再試行して
ください。
発生場所 行:1 文字:1
+ firebase
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (firebase:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\>

Pathを調べてみる

PS C:\> npm bin -g
C:\Users\takuma\AppData\Roaming\npm
(not in PATH env variable)

上記の通り、Pathが通ってないことが確認できたので、通常通りPathを追加したら…

PS C:\> firebase
Usage: firebase [options] [command]

Options:
  -V, --version                              output the version number
  -P, --project <alias_or_project_id>        the Firebase project to use for this command
  -j, --json                                 output JSON instead of text, also triggers non-interactive mode
  --token <token>                            supply an auth token for this command
  --non-interactive                          error out of the command instead of waiting for prompts
  --interactive                              force interactive shell treatment even when not detected
  --debug                                    print verbose debug output and keep a debug log file
  -h, --help                                 output usage information
~~~~~~~~~ 略 ~~~~~~~~~

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
2