平台“win32”与此模块不兼容(fsevents)
Posted
技术标签:
【中文标题】平台“win32”与此模块不兼容(fsevents)【英文标题】:The platform "win32" is incompatible with this module (fsevents) 【发布时间】:2021-03-30 14:02:14 【问题描述】:我正在尝试使用 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。跨度> 非常感谢您的建议。目前我必须继续使用 Windows 操作系统。 【参考方案1】:您可以忽略此警告。查看有关此警告的更多信息here
这是预期的,可以忽略。我们还不能忽略可选包(在本例中为画布)
要禁用此消息,请尝试使用:
yarn config set ignore-engines true
或者尝试使用--use-npm --no-optional
标志
npx create-react-app first-react-app --use-npm --no-optional
【讨论】:
感谢您的信息和建议,但仍然收到警告。 @Sinan.D,我更新了答案,试试--use-npm
flag
@Sinan.D,试试npx create-react-app first-react-app --use-npm --no-optional
。如果有帮助,请告诉我,我会更新答案
再次感谢,再次收到警告,但最终它正在创建。也许摆脱它的唯一方法是使用 fsevents 支持的平台,即按照@jonrsharpe 的建议切换到 macOS。
@Sinan.D,是的,这将是最好的解决方案)【参考方案2】:
我尝试了这里提供的所有解决方案,但最好的解决方案是同时添加两者
--ignore-engines --ignore-platform
我是 Windows 10 用户,我的 yarn 版本是 1.22.17。可能它也适用于 npm。我的问题来自 fsevents@2.3.2
所以最终的 cmdlet 是:
yarn install --ignore-engines --ignore-platform
【讨论】:
以上是关于平台“win32”与此模块不兼容(fsevents)的主要内容,如果未能解决你的问题,请参考以下文章
本模块与 react-native 中的 win32 不兼容
引擎“节点”与此模块不兼容。预期版本“X.X.X”。得到“X.X.X”