Help us understand the problem. What is going on with this article?

npmでグローバルインストールしたモジュールのコマンドが使えなかった時に解決した方法

More than 1 year has passed since last update.

npmで複数のモジュールをインストールした際に、command not foundとなってしまうことが多々あった.

解決手順

1.パスを通すべき位置を確認

細かい部分はわからないのだが、グローバルインストールされるモジュールのbinにパスを通す必要があるようで

npm bin -g
/Users/user_name/.npm-global/bin

のようにする.
この結果、自分の場合は/Users/user_name/.npm-global/binへパスを通す必要があると判明.

2.先程確認したパスをbash_profileへ書き込む

vi ~/.bash_profile

として開いたファイルの末尾に、

PATH=$PATH:/Users/user_name/.npm-global/bin

を追記すれば良い.

3.bash_profileの変更を反映

コマンドプロンプトのタブを新たに開けば良い.

source ~/.bash_profile

以上のコマンドでも変更の反映が可能らしい.

参考ページ

色々
(のちに追記する予定)

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away