Troubleshooting
The most common malfunctions that may come up when using the Gowebly CLI.
🤔 在这里找不到答案?
请随时在 Gowebly 项目库中创建一个 issue 或发起一个 discussion 。当然,我们也非常欢迎您发送 PR,提出改进文档的建议。
Port X is taken by OS
Some operating systems may take up ports that you want to use to develop and deploy your application. You can check if a port is taken by OS by running the command:
bash
lsof -iTCP -sTCP:LISTEN -P
bash
lsof -iTCP -sTCP:LISTEN -P
bash
netstat -aon
There are two ways to change it.
- Set the port number in the
BACKEND_PORT
environment variable before running:
bash
BACKEND_PORT=9000 gowebly run
yaml
# docker-compose.yml
services:
gowebly_default:
# ...
ports:
- '9000:9000'
environment:
BACKEND_PORT: 9000 # same as the exposed container port
# ...
# ...
- Edit the port number in the
server.go
file:
go
// runServer runs a new HTTP server with the loaded environment variables.
func runServer() error {
// Validate environment variables.
port, err := strconv.Atoi(gowebly.Getenv("BACKEND_PORT", "9000"))
if err != nil {
return err
}
// ...
Now, you can open your browser and go to the http://localhost:9000
.