2018年7月17日 星期二

[Mac/OSX]使用npm安裝http-server會出現command not found問題


使用以下指令安裝http-server
npm i http-server -g

run http-server時卻出現command not found


因為node的全域執行檔會放在此(此資料裡面有http-server等執行檔)
/User/你的名字/.npm-global/bin

因此去設定環境變數的path即可(Terminal中輸入)
export PATH=$PATH:/User/你的名字/.npm-global/bin

成功!
http-server


沒有留言:

張貼留言