[英]Node http-server not working on Windows 10 Ubuntu Bash
我只是嘗試在Windows 10 Ubuntu Bash上安裝NodeJS http-server
,安裝工作正常,但運行它以服務靜態站點$http-server src
拋出此錯誤:
$ http-server src
/usr/lib/node_modules/http-server/bin/http-server:14
var ifaces = os.networkInterfaces();
^
Error: EINVAL, invalid argument
at Object.<anonymous> (/usr/lib/node_modules/http-server/bin/http-server:14:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:945:3
這里可以缺少什么? 在Windows 10上使用Ubuntu bash不支持?
更新:自Windows 10 Creators更新(2017年4月)以來,此問題已得到修復。
對於一些尚未針對Windows上的Bash或Windows-Linux子系統(WSL)實現的低級網絡代碼,目前這是一個已知的問題[ 1 ] [ 2 ] [ 3 ] [ 4 ]。
在修復之前,您可以嘗試使用live-server
:
sudo npm install live-server -g
live-server src
或者可能是Python的SimpleHTTPServer:
cd src
python -m SimpleHTTPServer 8000
為了幫助盡早解決問題,建議您在Windows Uservoice網站上的Bash上投票,因為Microsoft將使用這些投票來確定哪些問題可以在任何即將發布的更新中確定優先級。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.