启动lite-server时,可以指定端口,例如
lite-server -- port 8000这将给出以下结果:
[BS] Access URLs:
------------------------------------
Local: http://localhost:8000
External: http://192.168.0.5:8000
------------------------------------
UI: http://localhost:3001
UI External: http://192.168.0.5:3001如何将默认为3001的UI (命令行和/或bs-config.json文件)的端口更改为like 8001?
发布于 2016-02-20 09:01:16
由于lite-server使用浏览器同步,因此可以通过BrowserSync options进行更改
不确定命令行参数,但bs-config.json的工作方式如下:
{
"port": 8000,
"files": ["./dist/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./" },
"ui": {
"port": 8001
}
}BrowserSync command line options (that also work with lite-server)
发布于 2017-01-25 04:28:45
对于像我这样思维迟钝的人来说,要在不同的端口上运行lite-server,只需在项目的根目录(或运行lite-server的任何位置)创建bs-config.json文件,并将其添加到bs-config.json中
{
"port": 8080
}这将在端口8080上运行lite服务器
或者,您也可以在运行lite-server时传递bs-config.json的路径
lite-server -c configs/my-bs-config.json来源:https://github.com/johnpapa/lite-server#custom-configuration
https://stackoverflow.com/questions/35516783
复制相似问题