React Native 错误:“fsevents”不可用(此观察程序只能在达尔文上使用)

x6yk4ghg  于 2023-01-18  发布在  React
关注(0)|答案(8)|浏览(424)

我正在本地环境中克隆一个现有的React原生应用,但每次运行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

在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.

我只在为我克隆的repo运行react-native run-ios时遇到这个错误。但是当我创建一个新的react-native应用时一切正常。我尝试了所有方法:杀死服务器,卸载和重新安装节点,删除我的node_modules文件等,我仍然不能解决这个问题。任何帮助将不胜感激。谢谢。

mnemlml8

mnemlml81#

对于我来说,我卸载了watchman,然后使用brew重新安装,如下所示:

npm r -g watchman 
brew install watchman
8ulbf1ek

8ulbf1ek2#

npm install -g fsevents

对我有用

d4so4syb

d4so4syb3#

我在编写react原生应用程序时遇到了以下问题,这似乎是watchman的一个错误,所以我们需要重新安装它:
brew remove watchman
brew install watchman
希望能有所帮助,

6mw9ycah

6mw9ycah4#

我在尝试运行jest watch时遇到了同样的错误。对我来说,简单的解决方案是通过npm安装fsevents模块(我认为这是错误消息告诉你的)。我也在使用一个React应用程序,并遇到了其他类似的错误。
希望这有帮助!

f0ofjuux

f0ofjuux5#

我在create-react-app中遇到这种情况。我通过更新react-scripts解决了这个问题
yarn add react-scripts@latest
然后删除node_modules,并重新安装
yarn

w1e3prcc

w1e3prcc6#

卸载watchman,然后用brew worked重新安装:

npm r -g watchman

那么

brew install watchman
w80xi6nr

w80xi6nr7#

在我的例子中,在MacOS更新之后,我需要yarn的更新版本。

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

uplii1fm8#

有时这个问题可能与你运行的节点版本有关。如果你使用的是nvm,试着切换到不同的节点版本,看看它是否修复了。它对我在一个类似的问题上起了作用。

相关问题