Fork me on GitHub
#cljsrn
<
2017-04-05
>
harrybin02:04:32

lein prod-build with a hyphen?

pawel.kapala10:04:54

@harrybin ofc with a hyphen, but that is just a typo here in slack πŸ˜‰

harrybin10:04:10

hmm, ok, haven't had that problem myself. If you delete the app, run a lein clean and try again, is there any difference?

harrybin10:04:30

Am using re-natal 0.3.7 atm

pawel.kapala10:04:36

Unfortunately yes, I tried deleting the app on iPad, cleaning lein, cleaning npm or even removing watchman cache, no use 😞 (FWIW both compilations go without warning: lein and node)

pawel.kapala10:04:00

I’ll try upgrading re-natal, maybe that helps

harrybin10:04:18

Yeah, might do the trick

pawel.kapala11:04:38

@harrybin Strangely after examining the jsbundle I can see updates. It seems it is not packed into the app correctly, not sure why… I’ll keep looking

pawel.kapala12:04:26

So I followed suggestion from: https://medium.com/@tiensonqin/my-experience-with-clojurescript-and-react-native-81bb1d3bb2c4 and I did:

npm cache clean && watchman watch-del-all && rm -rf node_modules && npm install && npm start -- β€”reset-cache
And now I get (when running the app):
Terminating app due to uncaught exception 'RCTFatalException: No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application 

pawel.kapala12:04:20

So it looks as though it kept on using old jsbundle πŸ˜•

pawel.kapala12:04:31

manual run:

react-native bundle --dev false --assets-dest ./ios --entry-file index.ios.js --platform ios --bundle-output ios/main.jsbundle
gives me another tip:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
I’ll try to spare some more of my precious RAM to node then

pawel.kapala12:04:12

with:

node --max-old-space-size=4096 /usr/local/bin/react-native bundle --entry-file index.ios.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

harrybin12:04:33

I've not had the out of memory with recent versions of react native, only with the packager in an older RN version. But my mac mini has 8GB of RAM so maybe that's enough to not run into the issue.

misha12:04:14

haven't heard of "out of memory" in a while too

pawel.kapala12:04:14

@harrybin it’s not the matter of installed mem, but the mem you give to node

harrybin12:04:28

I haven't given node more mem as far as I can remember but I'll check my config here

harrybin12:04:45

Did you kill the packager process after the big clean and re-install of node modules?

harrybin12:04:34

If a clean re-natal init works putting it as prod on the ipad, but not when you copy your sources over it, that might be an indication that there's something in the added sources it chokes on.

pawel.kapala12:04:36

yeah, I thought about that as well, that’s why I just copied cljs and images to the fresh template (named the same)

pawel.kapala13:04:22

It was the mem issue all along, but I kept on running node from command line, and xcode builds overriden that and silently failed with out of mem error.

misha13:04:57

how did you config node from xcode? you did, didn't you?

pawel.kapala13:04:47

So the solution is to modify project Build Phases and replace Bundle React Native code and images: From:

export NODE_BINARY=node
../node_modules/react-native/packager/react-native-xcode.sh
To:
export NODE_BINARY="node --max-old-space-size=4096"
../node_modules/react-native/packager/react-native-xcode.sh

pawel.kapala13:04:50

Thanks for your tips, as new react-native scripts (from new re-natal template) generated warning that was picked up by xcode that actually led me to finding this.

pawel.kapala13:04:23

I’m not sure if I should be reporting this as a bug, because when you run out of node memory during build it wouldn’t fail (xcode build) and you wouldn’t even know that previous bundle was used!

kurt-o-sys16:04:06

Solving SyntaxError: Strict mode does not allow function declarations in a lexically nested statement. ()? I followed https://github.com/drapanjanas/re-natal:

$ re-natal init FutureApp -i rum
$ react-native start
$ adb reverse tcp:8081 tcp:8081
$ adb reverse tcp:3449 tcp:3449
$ re-natal use-android-device real
$ re-natal use-figwheel
$  lein figwheel android
$ react-native run-android
No errors anywhere, except on my device...

kurt-o-sys16:04:39

OK, let's try again: terminal 1:

$ react-native start
Scanning 706 folders for symlinks in <project-home>/node_modules (3ms)
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 
 β”‚  Running packager on port 8081.                                            β”‚ 
 β”‚                                                                            β”‚ 
 β”‚  Keep this packager running while developing on any JS projects. Feel      β”‚ 
 β”‚  free to close this tab and run your own packager instance if you          β”‚ 
 β”‚  prefer.                                                                   β”‚ 
 β”‚                                                                            β”‚ 
 β”‚                                    β”‚ 
 β”‚                                                                            β”‚ 
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 
Looking for JS files in
   <project-home> 

[4/5/2017, 6:58:02 PM] <START> Building Dependency Graph
[4/5/2017, 6:58:02 PM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot

React packager ready.

[4/5/2017, 6:58:02 PM] <END>   Crawling File System (154ms)
[4/5/2017, 6:58:02 PM] <START> Building in-memory fs for JavaScript
[4/5/2017, 6:58:03 PM] <END>   Building in-memory fs for JavaScript (176ms)
[4/5/2017, 6:58:03 PM] <START> Building in-memory fs for Assets
[4/5/2017, 6:58:03 PM] <END>   Building in-memory fs for Assets (148ms)
[4/5/2017, 6:58:03 PM] <START> Building Haste Map
[4/5/2017, 6:58:03 PM] <START> Building (deprecated) Asset Map
[4/5/2017, 6:58:03 PM] <END>   Building (deprecated) Asset Map (61ms)
[4/5/2017, 6:58:03 PM] <END>   Building Haste Map (199ms)
[4/5/2017, 6:58:03 PM] <END>   Building Dependency Graph (684ms)

kurt-o-sys17:04:28

terminal 2:

$ re-natal use-android-device real
Using 'localhost' for device type real
Please run: re-natal use-figwheel to take effect.
$ re-natal use-figwheel
Cleaning...
index.ios.js was regenerated
index.android.js was regenerated
Host in RCTWebSocketExecutor.m was updated
Dev server host for iOS: localhost
Dev server host for Android: localhost
$ lein figwheel android
Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid :)
Figwheel: Starting server at 
Figwheel: Watching build - android
Figwheel: Cleaning build - android
Compiling "target/android/not-used.js" from ["src" "env/dev"]...
Successfully compiled "target/android/not-used.js" in 8.379 seconds.
Launching ClojureScript REPL for build: android
Figwheel Controls:
          (stop-autobuild)                ;; stops Figwheel autobuilder
          (start-autobuild [id ...])      ;; starts autobuilder focused on optional ids
          (switch-to-build id ...)        ;; switches autobuilder to different build
          (reset-autobuild)               ;; stops, cleans, and starts autobuilder
          (reload-config)                 ;; reloads build config and resets autobuild
          (build-once [id ...])           ;; builds source one time
          (clean-builds [id ..])          ;; deletes compiled cljs target files
          (print-config [id ...])         ;; prints out build configurations
          (fig-status)                    ;; displays current state of system
  Switch REPL build focus:
          :cljs/quit                      ;; allows you to switch REPL to another build
    Docs: (doc function-name-here)
    Exit: Control+C or :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application

kurt-o-sys17:04:48

terminal 3:

$ adb reverse tcp:8081 tcp:8081
$ adb reverse tcp:3449 tcp:3449
$ react-native run-android
JS server already running.
Running /opt/android-sdk-linux//platform-tools/adb -s ZY223KDRZQ reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0350Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'Moto G (4) - 7.0'
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 12.07 secs

This build could be faster, please consider using the Gradle Daemon: 
Starting the app on ZY223KDRZQ (/opt/android-sdk-linux//platform-tools/adb -s ZY223KDRZQ shell am start -n <project>/.MainActivity)...
Starting: Intent { cmp=com.prigly/.MainActivity }

kurt-o-sys17:04:16

Now I get: Could nog get BatchedBridge, make sure you bundle is packaged correctly ...

kurt-o-sys17:04:24

How to debug this?

kurt-o-sys17:04:51

(Or how to find out what's wrong, since it's a fresh install re-natal init <project>?)

kurt-o-sys18:04:27

ok... With some changes in package.json, it seems to be better... however, now, the app keeps on waiting for Fighweel to load the files:

Waiting for Figwheel to load files.

kurt-o-sys18:04:21

$ lein figwheel android
Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid :)
Figwheel: Starting server at 
Figwheel: Watching build - android
Figwheel: Cleaning build - android
Compiling "target/android/not-used.js" from ["src" "env/dev"]...
Successfully compiled "target/android/not-used.js" in 10.082 seconds.
Launching ClojureScript REPL for build: android
Figwheel Controls:
          (stop-autobuild)                ;; stops Figwheel autobuilder
          (start-autobuild [id ...])      ;; starts autobuilder focused on optional ids
          (switch-to-build id ...)        ;; switches autobuilder to different build
          (reset-autobuild)               ;; stops, cleans, and starts autobuilder
          (reload-config)                 ;; reloads build config and resets autobuild
          (build-once [id ...])           ;; builds source one time
          (clean-builds [id ..])          ;; deletes compiled cljs target files
          (print-config [id ...])         ;; prints out build configurations
          (fig-status)                    ;; displays current state of system
  Switch REPL build focus:
          :cljs/quit                      ;; allows you to switch REPL to another build
    Docs: (doc function-name-here)
    Exit: Control+C or :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application

harrybin22:04:21

You can try re-natal use-android-device <dev-server-ip> and not use the adb reverse stuff when doing dev with figwheel.