在 rander 上托管 Express 应用程序时出现 MongooDB 版本错误

问题描述 投票:0回答:4

我在 Render.com 上托管时遇到 Node 版本的 Mongoose 错误

状态显示:构建代码时以状态 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  ==> 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 [email protected]: 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 😞

如何解决此问题,如果无法解决错误,请给出“渲染”的替代方案。

node.js express mongoose hosting
4个回答
1
投票

我在 render.com 上找到了有关指定节点版本的文档

https://render.com/docs/node-version

在 package.json 中添加这些行

  "engines": {
    "node": ">=14.20.1"
  },

然后提交并推送到 git, 在“渲染”上部署最新的提交

问题现已解决


1
投票

在 package.json 中添加这行代码。

"engines": {
    "node": ">=NODE_JS_VERSION"
},

1
投票

将其添加到您的 package.json

"engines": { "node": ">=14.20.1" }


0
投票

我也有同样的问题。

我将节点版本更改为 18.17.0,而不是渲染默认版本 14.17.0。

您可以查看本指南以获取更多信息。 https://render.com/docs/node-version

© www.soinside.com 2019 - 2024. All rights reserved.