简体   繁体   English

create-react-app(发现不兼容的模块)

[英]create-react-app (Found incompatible module)

I have this problem on create-react-app我在create-react-app上有这个问题

my node version 10.16.3我的node version 10.16.3

my npm version 6.9.0我的npm version 6.9.0

npx create-react-app mac

Creating a new React app in /home/brian/Documentos/mac/mac ./home/brian/Documentos/mac/mac创建一个新的 React 应用程序。

warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior.警告您正在使用不受支持的节点“13.0.0-nightly20190802452b393c1f”,可能会遇到错误或意外行为。 Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0" Installing packages. Yarn 支持以下 semver 范围:“^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0” 安装包。 This might take a couple of minutes.这可能需要几分钟时间。 Installing react, react-dom, and react-scripts...安装 react、react-dom 和 react-scripts...

yarn add v1.17.3 warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. yarn add v1.17.3 警告您正在使用不受支持的节点“13.0.0-nightly20190802452b393c1f”,可能会遇到错误或意外行为。 Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0" [1/4] Resolving packages... [2/4] Fetching packages... error @babel/core@7.5.5: The engine "node" is incompatible with this module. Yarn 支持以下 semver 范围:“^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0” [1/4] 解析包... [2/4] 获取包。 .. 错误@babel/core@7.5.5:引擎“节点”与此模块不兼容。 Expected version ">=6.9.0".预期版本 ">=6.9.0"。 Got "13.0.0-nightly20190802452b393c1f" error Found incompatible module.得到“13.0.0-nightly20190802452b393c1f”错误发现不兼容的模块。 info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. info 访问https://yarnpkg.com/en/docs/cli/add获取有关此命令的文档。

Aborting installation.正在中止安装。

yarnpkg add --exact react react-dom react-scripts --cwd /home/brian/Documentos/mac/mac has failed. yarnpkg add --exact react react-dom react-scripts --cwd /home/brian/Documentos/mac/mac 失败。

Deleting generated file... package.json正在删除生成的文件... package.json

Deleting generated file... yarn.lock正在删除生成的文件...yarn.lock

Deleting mac/ from /home/brian/Documentos/mac从 /home/brian/Documentos/mac 中删除 mac/

Done.完毕。

create-react-app react-app --use-npm

这对我有用

It appears the node version you're using isn't compatible.您使用的节点版本似乎不兼容。 Can you try using node 10 or 12?您可以尝试使用节点 10 或 12 吗? I suggest using nvm to manage the different node versions.我建议使用nvm来管理不同的节点版本。

Many packages define an explicit node version in their package.json .许多包在它们的package.json定义了一个显式的节点版本。 For example, in @babel/core :例如,在@babel/core

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

It seems your node version: 13.0.0-nightly20190802452b393c1f isn't valud for these requirements.似乎您的节点版本: 13.0.0-nightly20190802452b393c1f不符合这些要求。

You can see the source in yarn that handles this.你可以在yarn看到处理这个的源代码

You can see here that it appears the semver package does not handle this:你可以在这里看到semver包似乎没有处理这个:

import semver from "semver";

console.log(semver.satisfies("13.0.0", ">=6.9.0")); // true
console.log(semver.satisfies("13.0.0-nightly20190802452b393c1f", ">=6.9.0")); // false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM