平台"win32"与此模块(fsevents)不兼容。

9

我正在尝试使用npx create-react-app first-react-app创建React应用。

每次开始创建应用程序时,我都会收到以下警告。 最后它创建了一个应用程序。但是原因是什么以及如何永久解决这个问题呢?

以下是所有日志:

yarn add v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.2.1: The platform "win32" is incompatible with this module.
info "fsevents@2.2.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 6 new dependencies.

Installing template dependencies using yarnpkg...
yarn add v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.2.1: The platform "win32" is incompatible with this module.
info "fsevents@2.2.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > @testing-library/user-event@12.6.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.
Done in 179.26s.
Removing template package using yarnpkg...

yarn remove v1.22.10
[1/2] Removing module cra-template...
[2/2] Regenerating lockfile and installing missing dependencies...
info fsevents@2.2.1: The platform "win32" is incompatible with this module.
info "fsevents@2.2.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
warning " > @testing-library/user-event@12.6.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
success Uninstalled packages.
Done in 54.33s.

鉴于这是一个受支持的平台警告,唯一摆脱它的方法是使用一个被fsevents支持的平台,即切换到macOS。 - jonrsharpe
非常感谢您的建议。目前我必须继续使用Windows操作系统。 - Sinan.D
2个回答

16

您可以忽略此警告。有关此警告的更多信息,请在此处查看

这是正常现象,可以忽略。我们目前无法忽略可选包(在本例中为canvas)。

要禁用此消息,请尝试使用:

yarn config set ignore-engines true

或尝试使用 --use-npm --no-optional 标志。

npx create-react-app first-react-app --use-npm --no-optional

感谢您提供的信息和建议,但是仍然收到警告。 - Sinan.D
@Sinan.D,我更新了答案,请尝试使用 --use-npm 标志。 - xom9ikk
@Sinan.D,尝试使用npx create-react-app first-react-app --use-npm --no-optional。如果有帮助,请告诉我,我会更新答案。 - xom9ikk
再次感谢,虽然会收到警告,但最终还是创建了。也许摆脱它的唯一方法是使用受fsevents支持的平台,即像@jonrsharpe建议的那样切换到macOS。 - Sinan.D
@Sinan.D,是的,这将是最佳解决方案) - xom9ikk

8
我尝试了这里提供的所有解决方案,但最好的解决方案是同时添加两个。
--ignore-engines --ignore-platform 

我是一位使用Windows 10的用户,我的yarn版本为1.22.17。可能这也适用于npm。我的问题出现在fsevents@2.3.2上。
因此,最终的命令是:
yarn install --ignore-engines --ignore-platform

1
这对我没有用。问题仍然存在。$ yarn global --ignore-engines --ignore-platform add n yarn global v1.22.17 [1/4] 正在解析包... [2/4] 正在获取包... error n@8.0.2: 平台“win32”与此模块不兼容。 error 找到不兼容的模块。 info 访问 https://yarnpkg.com/en/docs/cli/global 以获取有关此命令的文档。 - C.T. Bell

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接