微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

运行 npx 以启动 Strapi 应用程序时,我收到与我的 Node 版本相关的相同错误

如何解决运行 npx 以启动 Strapi 应用程序时,我收到与我的 Node 版本相关的相同错误

我只是想开始,我总是遇到同样的错误。我已经运行了以下 npx 命令来启动我的第一个 Strapi 应用程序:

npx create-strapi-app strapi-blog --quickstart

每次我收到如下错误提示

 Error while installing dependencies:
error strapi-blog@0.1.0: The engine "node" is incompatible with this module. Expected version ">=10.16.0 <=14.x.x". Got "15.3.0"
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 mentionned in the installation errors and try to run the following command:
 
cd /Users/seanmodd/Courses/Udemy/Strapi/strapi-blog && yarn install

我实际上卸载并重新安装了节点版本 12、13 和 14.5.3 以查看它是否会修复它 - 我使用 nvm(节点版本管理器)执行此操作但无济于事......仍然收到相同的错误,指出:

'The engine "node" is incompatible with this module. Expected version ">=10.16.0 <=14.x.x". Got "15.3.0" Keep trying!

然后我做了一些研究,发现其他用户所说的是帮助他们运行 yarn create stripi-app stripi-blog --quickstart。我通过每个节点分别运行它们,然后卸载它们等,完全相同的过程,但从未让它工作。 这是我在 browser 上遇到的错误。这是我运行时的终端 yarn create stripi-app stripi-blog --quickstart 或 npx create-strapi-app stripi-blog --quickstart 没关系我仍然从我的终端中获得以下内容,我已将其包含在两个截图,因为我想显示完整的结果。 Herehere

为了澄清,this is also always what i get when i run yarn start...

解决方法

错误提到节点引擎 npx 使用的是 v15.3.0,它被 strapi-blog@0.1.0 声明为不兼容。

您应该能够通过以下命令确认 npx 正在使用哪个节点版本:npx --call "node -v"

我认为您需要做的就是访问 nodejs.org,下载并安装 v14.15.3,并确保 npx 正在使用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。