安装 Strapi Starter Next Ecommerce 时节点版本不兼容

Node version incompatible when installing Strapi Starter Next Ecommerce

我是节点的新手,我认为错误是说我的节点太新了。该站点上的其他答案告诉我们如何升级他们的节点,但我如何将我的节点与软件包想要的节点相匹配?

C:\react>npx create-strapi-starter@3 strapi-ecomm next-ecommerce
Need to install the following packages:
  create-strapi-starter@3
Ok to proceed? (y) y
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'create-strapi-starter@3.6.8',
npm WARN EBADENGINE   required: { node: '>=10.16.0 <=14.x.x', npm: '>=6.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.13.1', npm: '8.1.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'strapi-generate-new@3.6.8',
npm WARN EBADENGINE   required: { node: '>=10.16.0 <=14.x.x', npm: '>=6.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.13.1', npm: '8.1.2' }
npm WARN EBADENGINE }
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
? Choose your installation type Quickstart (recommended)
Creating a quickstart project.
Creating a new Strapi application at C:\react\strapi-ecomm\backend.
Creating files.
Installing strapi/strapi-template-ecommerce template.
Error while installing dependencies:
warning ..\..\package.json: No license field
error backend@0.1.0: The engine "node" is incompatible with this module. Expected version ">=10.16.0 <=14.x.x". Got "16.13.1"
error Found incompatible module.

 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 mentioned in the installation errors and try to run the following command:

cd C:\react\strapi-ecomm\backend && yarn install

C:\react>cd C:\react\strapi-ecomm\backend

C:\react\strapi-ecomm\backend>yarn install
yarn install v1.22.17
warning ..\..\package.json: No license field
info No lockfile found.
[1/5] Validating package.json...
error backend@0.1.0: The engine "node" is incompatible with this module. Expected version ">=10.16.0 <=14.x.x". Got "16.13.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

选项 #1 (NVM):

您有节点 v16.13.1(在 Windows 上),框架理想情况下需要节点 14.X.X,您需要降级节点,或者我的建议是使用 NVM 之类的东西,可以在以下位置找到说明:

https://github.com/coreybutler/nvm-windows#install-nvm-windows

安装后,您可以运行执行以下命令:

nvm install v14.18.3

然后是 nvm use v14.18.3,最后是 运行 执行您的命令并因此重置您的项目:npx create-strapi-starter@3 strapi-ecomm next-ecommerce.

如果您愿意,您还可以创建一个 .nvmrc 文件并将版本 (v14.18.3) 添加到其中,并在所需目录中自动默认为它。

对于其他上下文,使用 NVM 将允许您在计算机上使用多个版本的 NodeJS。


选项#2:

从以下位置卸载 Node v16 并安装 Node v14:https://nodejs.org/download/release/v14.18.3/