ptmt / react-native-macos

[deprecated in favor of https://microsoft.github.io/react-native-windows/] React Native for macOS is an experimental fork for writing desktop apps using Cocoa
MIT License
11.24k stars 429 forks source link

Doesn't work for me out of the box #179

Closed emirotin closed 7 years ago

emirotin commented 7 years ago

Description

On initial build it has failed with an error saying duplicate sane module. On consequent build it fails with ENOENT when trying to watch some file.

Reproduction Steps and Sample Code

Just follow the getting started steps from the readme.

Additional Information

ptmt commented 7 years ago

Does usual RN for iOS work for you? On Wed, 25 Oct 2017 at 15:48, Eugene Mirotin notifications@github.com wrote:

Description

On initial build it has failed with an error saying duplicate sane module. On consequent build it fails with ENOENT when trying to watch some file. Reproduction Steps and Sample Code

Just follow the getting started steps from the readme. Additional Information

  • React Native version:

react-native --version react-native-cli: 2.0.1

-

Platform: macOS apparently

Development Operating System: macOS

Dev tools: Xcode 9.0.1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ptmt/react-native-macos/issues/179, or mute the thread https://github.com/notifications/unsubscribe-auth/AA9SU76mQbV2uwtB__23U5jxw8v2R0saks5svy4IgaJpZM4QF8ZP .

emirotin commented 7 years ago

Didn't try it yet directly, I'm very new to it, will do and let you know

emirotin commented 7 years ago

RN works for me (iOS emulator and Expo), but I had to install watchman. The error that RN prints looks like this:

4:20:50 PM: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
  sudo sysctl -w kern.maxfiles=5242880
  sudo sysctl -w kern.maxfilesperproc=524288

Now with watchman I've tried the RN-macOS again. It has still generated the duplicate modules message, but it's a warning so is not likely the source of the problem.

It has also reported

** BUILD SUCCEEDED **

The following commands produced analyzer issues:
    Analyze /Users/eugene.mirotin/work/chgk-db-search/MyProject/node_modules/react-native-macos/ReactCommon/yoga/yoga/YGNodeList.c
    Analyze /Users/eugene.mirotin/work/chgk-db-search/MyProject/node_modules/react-native-macos/ReactCommon/yoga/yoga/Yoga.c
    Analyze DevSupport/RCTDevMenu.m
    Analyze Views/RCTBorderDrawing.m
    Analyze Base/RCTDisplayLink.m
    Analyze Base/UIImageUtils.m
    Analyze Modules/RCTRedBox.m
    Analyze Modules/RCTUIManager.m
    Analyze RCTText.m
(9 commands with analyzer issues)
Launching build/Build/Products/Debug/MyProject.app
LSOpenURLsWithRole() failed with error -10825 for the file /Users/eugene.mirotin/work/chgk-db-search/MyProject/macos/build/Build/Products/Debug/MyProject.app.
Launched org.reactjs.native.example.MyProject

and nothing else on the initial build.

The consequent build fails in the same way:

** BUILD SUCCEEDED **

Launching build/Build/Products/Debug/MyProject.app
LSOpenURLsWithRole() failed with error -10825 for the file /Users/eugene.mirotin/work/chgk-db-search/MyProject/macos/build/Build/Products/Debug/MyProject.app.
Launched org.reactjs.native.example.MyProject
emirotin commented 7 years ago

After opening the project in Xcode I've been told that my machine doesn't ave dev mod eon which I have enabled then. The build went OK, then when trying to run the proj from Xcode I see:

BY012085 runs macOS 10.12.6, which is lower than MyProject’s minimum deployment target. Change your project’s minimum deployment target or upgrade BY012085’s version of macOS.

Which kinda doesn't make sense.

ptmt commented 7 years ago

Do you run your project with the same folder as usual RN for iOS? RN for macOS should run on macOS 10.12, can you please search for all MACOSX_DEPLOYMENT_TARGET occurrences in your files?

emirotin commented 7 years ago

Not the same folder, tried both with freshly initialized apps I've searched for MACOSX_DEPLOYMENT_TARGET from VSCode and have only found it as a ref in Info.plist. When searching from Xcode (which I did before) I can also find it in various .xcodeproj files but it's never above 10.11 there: Alt text

trafnar commented 7 years ago

I'm having similar "doesn't work out of the box issues" I haven't done much investigating because I was just casually checking out this project, but I figured I'd leave the details here for the maintainers to reference if they are interested.

I ran the recommended commands:

$ npm install react-native-macos-cli -g
$ react-native-macos init MyProject
$ cd MyProject
$ react-native-macos run-macos

The first time, I got some kind of ENOENT error. and an empty macOS window appeared. I tried running react-native-macos run macos again without changing anything, and the result was different. This is the error that is produced now:

Loading dependency graph...2017-10-28 20:02 node[17258] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-28 20:02 node[17258] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-28 20:02 node[17258] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1022:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1360:11)
Loading dependency graph...~/Code/Flinto
Process terminated. Press <enter> to close the window

I realized this line could be the problem: Loading dependency graph...~/Code/Flinto the new terminal that opened went to my default directory, which is specified in my .bash_profile. I removed that line from my bash profile, and now it seems to correctly load from the MyProject folder, but upon running again, I got this similar result:

Loading dependency graph...
Bundling `index.macos.js`  ░░░░░░░░░░░░░░░░  0.0% (0/1)2017-10-28 20:08 node[17538] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-28 20:08 node[17538] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-28 20:08 node[17538] (FSEvents.framework) FSEventStreamStart: register_w ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1022:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1360:11)
Loading dependency graph...
Bundling `index.macos.js`  ░░░░░░░░░░░░░░░░  0.0% (0/1)~
Process terminated. Press <enter> to close the window

Again, I don't really know what any of this means, but just leaving it in case its helpful!

ptmt commented 7 years ago

Thanks for sharing the info, I'm thinking about adding it in some sort of FAQ

KevinHu2014 commented 6 years ago

Encountering the same problem.