2016-04-15 60 views
1

我得到上面的標題中提到的錯誤,在我的OSX安裝HTTP服務器節點http服務器 - HTTP:找不到命令

npm install http-server -g 

之後它在

/usr/local/bin/http-server -> /usr/local/lib/node_modules/http-server/bin/http-server 
/usr/local/bin/hs -> /usr/local/lib/node_modules/http-server/bin/http-server 
/usr/local/lib 

我試着安裝了它加上路徑,因爲我看到了作爲一個建議here這樣

PATH=$PATH:/usr/local/lib/node_modules/http-server 
+0

我已經運行了錯誤的命令,而不是我輸入http服務器 – Marco

+0

做'$ hs'工作的HTTP服務器解決了這個問題? –

+0

@Marco你找到了解決方案嗎? – davelowe85

回答

1

在Linux上ENV ironment。試試這個命令導出路徑

出口NODE_PATH = $ NODE_PATH:在/ usr/local/lib目錄/ node_modules/

然後運行你的應用程序。

0

在OS X/linux(ubuntu 16.04)環境中。我用如下命令

sudo npm -g install http-server

sudo npm install -g http-server