以前,来自cmd的http-server命令起作用了,但是突然,它刚刚停止被识别。回到工作状态时,浏览器无法连接到localhost:8000
。
我尝试三次重新安装模块。我已将http-server目录手动添加到PATH,而cmd仍然无法识别它。
C:\Users\ryuji>npm install -g http-server
C:\Users\ryuji\AppData\Roaming\npm\hs -> C:\Users\ryuji\AppData\Roaming\npm\node_modules\http-server\bin\http-server
C:\Users\ryuji\AppData\Roaming\npm\http-server -> C:\Users\ryuji\AppData\Roaming\npm\node_modules\http-server\bin\http-server
+ http-server@0.11.1
added 26 packages from 28 contributors in 2.582s
C:\Users\ryuji>http-server
'http-server' is not recognized as an internal or external command,
operable program or batch file.
运行带有节点的本地服务器
答案 0 :(得分:0)
http服务器需要与npm install -g http-server
一起全局安装