Strapi安装过程依赖安装报错

Getting an error during the dependency installation of Strapi installation process

最近我尝试使用“npx”将 Strapi 安装到我的 windows 计算机上。但是当 below.I 尝试卸载和安装 knex 但没有成功时,当依赖项更新时我收到错误消息。我该如何解决这个问题?

strapi-app>npx create-strapi-app . --quickstart
Creating a new Strapi application at D:\E-LEARNING\React Js\projects\strapi-app.

Creating a quickstart project.
Creating files.
Error while installing dependencies:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: strapi-app@0.1.0
npm ERR! Found: knex@0.19.5
npm ERR! node_modules/knex
npm ERR!   knex@"<0.20.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer knex@"^0.20.0" from strapi-connector-bookshelf@3.4.1
npm ERR! node_modules/strapi-connector-bookshelf
npm ERR!   strapi-connector-bookshelf@"3.4.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\user\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs21-01-12T10_28_05_191Z-debug.log

 Keep trying!

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentionned in the installation errors and try to run the following command:

cd D:\E-LEARNING\React Js\projects\strapi-app && npm install

npm ERR! code 1
npm ERR! path D:\E-LEARNING\React Js\projects\strapi-app
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-strapi-app . --quickstart

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs21-01-12T10_28_07_219Z-debug.log

Strapi 显然只支持 Node v14(当前的 LTS)。切换到该版本(NVM?)并重试。

我在部署到 heroku 时遇到了同样的问题。 它通过在 package.json:

中将 npm 版本从 >=6.0.0 更改为 6.14.9 来工作
  "engines": {
    "node": ">=10.16.0 <=14.x.x",
    "npm": "6.14.9"
  }

我像这样将我的 nodeJS 引擎版本更改为 v14,它起作用了:

  "engines": {
    "node": "14.x",
    "npm": "6.x"
  },

来源:推荐版本至少为12,但推荐14 https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/installation/cli.html#step-1-make-sure-requirements-are-met