LoginSignup
7
4

More than 3 years have passed since last update.

express コマンドのcommand not found を解決するのに手間取った話。

Last updated at Posted at 2020-03-21

【事象】

node.jsの expreass generatorを使って見ようと思い、
ターミナルからexpressコマンドを叩いてみたが、command not found

express --version     
zsh: command not found: express

先日、express-generatorのインストールだけをしていたのだが、
上手くいっていなかったのかと思い、再インストールをしてから試してみてもダメだった。

【原因&解決方法】

パスが通ってなかった。
node.jsをインストールしたときに、他の方の記事を見て、思考停止で色々な事をコピペしていたのがいけていなかった。
(自分がnode.jsインストールするときに何か余計な事をしたのかも。。。)

↓のコマンドでnpmのpathを確認する。

npm bin -g 

上記で表示されたpathを.bash_profile に設定する。
(↓のXXXXX部分を表示された内容に設定)
export PATH=XXXXX:${PATH}

設定したら、↓のコマンドを叩く。

source ~/.bash_profile

再度、expressコマンドを叩いたら上手くいった。

express --version    
4.16.1
7
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
7
4