简体   繁体   English

错误:`fsevents` 不可用(这个观察器只能在 Darwin 上使用)

[英]Error: `fsevents` unavailable (this watcher can only be used on Darwin)

I'm cloning an existing react native app in my local environment, but every time I run react-native run-ios I get the following error:我正在本地环境中克隆现有的 react native 应用程序,但是每次运行react-native run-ios ,都会出现以下错误:

** BUILD FAILED **


The following commands produced analyzer issues:
    Analyze /Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c normal x86_64

    Analyze /Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.c normal x86_64
    Analyze Base/RCTModuleMethod.mm normal x86_64
(3 commands with analyzer issues)

The following build commands failed:
    Ld build/Build/Products/Debug-iphonesimulator/MyUros.app/MyUros normal x86_64
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/TPP.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/TPP.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

And this error in react-packager:而 react-packager 中的这个错误:

Loading dependency graph...(node:52097) UnhandledPromiseRejectionWarning: Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/sane/src/fsevents_watcher.js:41:11)
    at createWatcher (/Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/jest-haste-map/build/index.js:600:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (/Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/jest-haste-map/build/index.js:747:25)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/jest-haste-map/build/index.js:279:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:52097) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:52097) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I only get this error when I run react-native run-ios for a repo I cloned.当我为克隆的 repo 运行react-native run-ios时,我只会收到此错误。 But when I create a new react-native app everything works fine.但是当我创建一个新的 react-native 应用程序时,一切正常。 I tried everything: killing the servers, uninstalling and installing node again, deleting my node_modules file, etc and still I can't solve this issue.我尝试了一切:杀死服务器,再次卸载和安装节点,删除我的 node_modules 文件等,但仍然无法解决这个问题。 Any help would be much appreciated.任何帮助将非常感激。 Thanks.谢谢。

For me I uninstalled watchman and then reinstalled it using brew as shown below:对我来说,我卸载了watchman ,然后使用brew重新安装它,如下所示:

npm r -g watchman 
brew install watchman
npm install -g fsevents

为我工作

I faced the following issue while coding a react native app.我在编写 React Native 应用程序时遇到了以下问题。 It seemed to be an error with watchman, so all we need is to re-install it: watchman 似乎是一个错误,所以我们只需要重新安装它:

brew remove watchman

brew install watchman

I hope it helps,我希望它有帮助,

I got the same error when trying to run jest watch.尝试运行 jest watch 时遇到了同样的错误。 Simple solution for me was to install the fsevents module through npm (which I assume this is what your error message is telling you).对我来说,简单的解决方案是通过 npm 安装 fsevents 模块(我认为这是您的错误消息告诉您的)。 I was also working with a React app and had additional similar errors.我也在使用 React 应用程序并遇到了其他类似的错误。

Hope this helps!希望这可以帮助!

This happened in a create-react-app for me.这发生在我的create-react-app中。 I resolved this by updating react-scripts我通过更新react-scripts解决了这个问题

yarn add react-scripts@latest

Then deleting node_modules , and re-installing然后删除node_modules ,并重新安装

yarn

Uninstalling watchman and then reinstalling with brew worked:卸载 watchman 然后用 brew 重新安装工作:

npm r -g watchman npm r -g 守望者

brew install watchman酿造安装守望者

就我而言,在 MacOS 更新之后,我需要更新版本的yarn

curl --compressed -o- -L https://yarnpkg.com/install.sh | bash

Sometimes this issue could be related to the node version you are running.有时,此问题可能与您运行的节点版本有关。 If you are using nvm, try switching to a different node version and see if it fixes.如果您使用的是 nvm,请尝试切换到不同的节点版本并查看它是否已修复。 It worked for me on a similar issue.它在类似的问题上对我有用。

暂无
暂无

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

相关问题 npm安装错误fsevents 1和fsevents 2如何解决? - how to solve the npm installation error fsevents 1 and fsevents 2? 如何修复“TypeError:fsevents 不是构造函数”反应错误 - How to fix "TypeError: fsevents is not a constructor" react error 未捕获的错误:未提供上下文:useLeafletContext() 只能用于<mapcontainer></mapcontainer> - Uncaught Error: No context provided: useLeafletContext() can only be used in a descendant of <MapContainer> NPM 无法从 watchpack-chokidar2:fsevents 访问 CI 错误绑定 - NPM CI error bindings not accessible from watchpack-chokidar2:fsevents 如何修复 fsevents@2.1.3 不支持的平台:想要 {“os”:“darwin”,“arch”:“any”}(当前:{“os”:“win32”,“arch”:“x64”} ) - how to fix Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}) Flask:如何防止 heroku 出现 503(服务不可用)错误? - Flask: How I can prevent 503 (service unavailable) error on heroku? 错误:“类型”只能在 a.ts 文件中使用 - 使用 @ts-check 的 Visual Studio 代码 - Error: 'types' can only be used in a .ts file - Visual Studio Code using @ts-check 错误 [Vue 警告]:选项“el”只能在实例创建期间使用 `new` 关键字使用 - ERROR [Vue warn]: option "el" can only be used during instance creation with the `new` keyword 错误 R3F 钩子只能在 Canvas 组件中使用! 使用THREE函数 - Error R3F hooks can only be used within the Canvas component! UseTHREE function Angular 6 错误 TS8011 类型参数只能在 .ts 文件中使用 - Angular 6 error TS8011 type arguments can only be used in a .ts file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM