我有一个带有 MySQL 和令牌保护配置的 adonisjs API。过去两天我一直在尝试在渲染上部署,但我不断遇到问题。在推送到 GitHub 之前,我在本地运行了 build,然后将渲染上的根目录设置为“build”。构建命令是``npm install
and the start command is
npm run start`,它运行node bin/server.js。日志显示构建成功,但是在即将启动时却失败了。错误说:
错误:
听听
EADDR不可用:
地址
不是
可用
216.24.57.252:10000
这是我的日志:
It looks like we don't have access to your repo, but we'll try to clone it anyway.
==> Cloning from https://github.com/Ikem-coded-it/hello-world
==> Checking out commit fc4fcaae4f72785e0aac10d6f744e9279748fc7c in branch main
==> Requesting node version 21
==> Using Node version 21.7.3 via environment variable NODE_VERSION
==> Docs on specifying a Node version: https://render.com/docs/node-version
==> Using Bun version 1.1.0 (default)
==> Docs on specifying a bun version: https://render.com/docs/bun-version
==> Running build command 'npm install'...
added 398 packages, and audited 399 packages in 13s
104 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
==> Uploading build...
==> Build uploaded in 9s
==> Build successful 🎉
==> Deploying...
==> Requesting node version 21
==> Using Node version 21.7.3 via environment variable NODE_VERSION
==> Docs on specifying a Node version: https://render.com/docs/node-version
==> Using Bun version 1.1.0 (default)
==> Docs on specifying a bun version: https://render.com/docs/bun-version
==> Running 'npm run start'
> [email protected] start
> node bin/server.js
Error:
listen
EADDRNOTAVAIL:
address
not
available
216.24.57.252:10000
以及我的部署设置:
我没有在我的环境中指定端口,渲染提供了它自己的端口。如果任何有相同问题经验的人可以指出我正确的方向,我将不胜感激。
我尝试过使用部署设置和环境变量。我尝试在部署期间运行构建,将 cd 放入构建文件夹并 npm run start 但这不起作用,我收到了触发器未捕获的异常错误。
我遇到了同样的问题。检查您的环境变量并确保一切正常。您还可以在环境变量中手动将 HOST 定义为 0.0.0.0。