在我的OSX上用
安装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
我尝试添加路径,因为我看到这样的建议Agner Fog's microarchitecture guide就像这样
PATH=$PATH:/usr/local/lib/node_modules/http-server
答案 0 :(得分:1)
你在Linux环境中。尝试使用此命令导出路径
export NODE_PATH = $ NODE_PATH:/ usr / local / lib / node_modules /
然后运行你的应用程序。
答案 1 :(得分:0)
在OS X / linux(ubuntu 16.04)环境中。我使用follow命令
解决了这个问题
sudo npm -g install http-server
sudo npm install -g http-server