英文:
MongooDB version error while hosting on rander an Express App
问题
I'm getting a Mongoose error with the Node version while hosting on Render.com:
在 Render.com 上托管时,我遇到了与 Node 版本相关的 Mongoose 错误:
status showing: Exited with status 1 while building your code.
状态显示:在构建代码时以状态 1 退出。
Jun 15 12:09:54 PM ==> It looks like we don't have access to your repo, but we'll try to clone it anyway.
Jun 15 12:09:54 PM ==> 看起来我们无法访问您的仓库,但我们将尝试克隆它。
Jun 15 12:09:54 PM ==> Cloning from https://github.com/yashkolte/New-Instagram...
Jun 15 12:09:54 PM ==> 从 https://github.com/yashkolte/New-Instagram 克隆中...
Jun 15 12:09:56 PM ==> Checking out commit e6b9470786f0cd5ab8d449315eb3201968d9cc4f in branch main
Jun 15 12:09:56 PM ==> 检出主分支中的提交 e6b9470786f0cd5ab8d449315eb3201968d9cc4f
Jun 15 12:10:01 PM ==> Using Node version 14.17.0 (default)
Jun 15 12:10:01 PM ==> 使用 Node 版本 14.17.0(默认)
Jun 15 12:10:01 PM ==> Docs on specifying a Node version: https://render.com/docs/node-version
Jun 15 12:10:01 PM ==> 有关指定 Node 版本的文档:https://render.com/docs/node-version
Jun 15 12:10:01 PM ==> Running build command 'yarn'...
Jun 15 12:10:01 PM ==> 运行构建命令 'yarn'...
Jun 15 12:10:01 PM yarn install v1.22.5
Jun 15 12:10:01 PM info No lockfile found.
Jun 15 12:10:01 PM [1/4] Resolving packages...
Jun 15 12:10:08 PM [2/4] Fetching packages...
Jun 15 12:10:13 PM error mongoose@7.3.0: The engine "node" is incompatible with this module. Expected version ">=14.20.1". Got "14.17.0"
Jun 15 12:10:13 PM error Found incompatible module.
Jun 15 12:10:13 PM info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Jun 15 12:10:13 PM ==> Build failed 😢
如何解决这个问题,请提供 'render' 的替代方法,如果无法解决该错误。
英文:
I'm getting a Mongoose error with the Node version while hosting on Render.com
status showing: Exited with status 1 while building your code.
Jun 15 12:09:54 PM ==> It looks like we don't have access to your repo, but we'll try to clone it anyway.
Jun 15 12:09:54 PM ==> Cloning from https://github.com/yashkolte/New-Instagram...
Jun 15 12:09:56 PM ==> Checking out commit e6b9470786f0cd5ab8d449315eb3201968d9cc4f in branch main
Jun 15 12:10:01 PM ==> Using Node version 14.17.0 (default)
Jun 15 12:10:01 PM ==> Docs on specifying a Node version: https://render.com/docs/node-version
Jun 15 12:10:01 PM ==> Running build command 'yarn'...
Jun 15 12:10:01 PM yarn install v1.22.5
Jun 15 12:10:01 PM info No lockfile found.
Jun 15 12:10:01 PM [1/4] Resolving packages...
Jun 15 12:10:08 PM [2/4] Fetching packages...
Jun 15 12:10:13 PM error mongoose@7.3.0: The engine "node" is incompatible with this module. Expected version ">=14.20.1". Got "14.17.0"
Jun 15 12:10:13 PM error Found incompatible module.
Jun 15 12:10:13 PM info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Jun 15 12:10:13 PM ==> Build failed 😞
How to fix this problem, please give the alternative of 'render' if the error can't be resolved.
答案1
得分: 1
在你的package.json文件中添加以下代码行:
"engines": {
"node": ">=NODE_JS_VERSION"
}
英文:
Add this line of code in your package.json.
"engines": {
"node": ">=NODE_JS_VERSION"
},
答案2
得分: 1
Sure, here's the translated content:
将此添加到您的package.json文件中:
"engines": {
"node": ">=14.20.1"
}
英文:
Add this to your package.json
"engines": {
"node": ">=14.20.1"
}
答案3
得分: 0
我在 render.com 上找到了有关指定 Node 版本的文档。
https://render.com/docs/node-version
在 package.json 中添加以下行:
"engines": {
"node": ">=14.20.1"
},
然后提交并推送到 Git,部署最新的提交到 'render'。
问题现在已解决。
英文:
I found documentation on Specifying a Node Version on render.com
https://render.com/docs/node-version
add these lines in package.json
"engines": {
"node": ">=14.20.1"
},
then commit and push to git,
deploy the latest commit on 'render'
The problem is now resolved
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论