【问题标题】:Node version incompatible when installing Strapi Starter Next Ecommerce安装 Strapi Starter Next Ecommerce 时节点版本不兼容
【发布时间】:2022-01-22 11:16:23
【问题描述】:

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

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.

【问题讨论】:

    标签: node.js npm yarnpkg strapi


    【解决方案1】:

    选项 #1 (NVM):

    您有节点 v16.13.1(在 Windows 上),理想情况下该框架需要 Node 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:

    https://nodejs.org/download/release/v14.18.3/卸载 Node v16 并安装 Node v14

    【讨论】:

    • 非常感谢。我刚刚安装了 nvm,我收到了这个错误npm WARN deprecated nvm@0.0.4: This is NOT the correct nvm. Visit https://nvm.sh and use the curl command to install it. 我去了文档,没有关于如何在 Win10 中使用curl 的说明。只提到了Linux。好的,我试试你的链接。
    • @ratib90486 您是否尝试过从github.com/coreybutler/nvm-windows#install-nvm-windows 安装 NVM,您应该能够忽略该错误并继续执行我的答案中提供的其余命令
    • 我点击了你的链接,现在我的 CLI 显示 C:\&gt;nvm install v14.18.3 This is not the package you are looking for: please go to http://nvm.sh
    • 能不能运行node -v看看node版本有没有变化?理想情况下应该是v14.18.3 并且请确保您在安装 NVM 后重新加载了您的终端。
    • 好的,我试试。非常感谢!
    猜你喜欢
    • 2022-06-11
    • 2020-06-19
    • 2016-11-09
    • 2021-03-24
    • 1970-01-01
    • 2021-03-30
    • 2014-04-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多