JaneaSystems / nodejs-mobile

Full-fledged Node.js on Android and iOS
https://code.janeasystems.com/nodejs-mobile
Other
2.58k stars 182 forks source link

nodejs not defined #175

Open DeniscoDp5 opened 5 years ago

DeniscoDp5 commented 5 years ago

Hi, i get nodejs not defined when deugging the app build using the sample. on cordova 7.1.0 android@8.0.0.

How could i resolve the problem?

jaimecbernardo commented 5 years ago

Hi @DeniscoDp5 ,

There are other issues in the repo about this error. I'd recommend looking into them. Here's an example, where the ANDROID_NDK_HOME environment variable was not set: https://github.com/janeasystems/nodejs-mobile/issues/86

It could also be about cordova 7.1.0 android not being supported by nodejs-mobile-cordova 0.2.3. We've released an update to support more recent versions of Cordova today: nodejs-mobile-cordova 0.2.4. Please give it a try as well.

osamax2 commented 5 years ago

hi @DeniscoDp5 I have the same issue this is my platform data : Project: nodejs-mobile-cordova Version: 0.3.3 Mobile device: android Development Node.js: Development platform: ubuntu 14.04 cordova 7.1.0 android@8.0.0 classpath 'com.android.tools.build:gradle:3.3.1' gradle:gradle-4.10.1 defaultBuildToolsVersion="28.0.3" defaultMinSdkVersion=21 defaultTargetSdkVersion=28 defaultCompileSdkVersion=28 node : v10.16.0 npm : 6.9.0 ANDROID_NDK_HOME is not the problem i have NDK 20 and in ~/.bashrc export ANDROID_HOME=/home/slimane/Android/ export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools export ANDROID_NDK_HOME=/home/slimane/Android/ndk-bundle export PATH=/home/slimane/AVGDashboardMobile/gradle-4.10.1/bin:$PATH

I don’t have build problem but this is console result : D/SystemWebChromeClient: file:///android_asset/www/js/index.js: Line 80 : Uncaught ReferenceError: nodejs is not defined I/chromium: [INFO:CONSOLE(80)] "Uncaught ReferenceError: nodejs is not defined", source: file:///android_asset/www/js/index.js (80)

How could i resolve the problem? thank you in Advance

jaimecbernardo commented 5 years ago

Hi @osamax2 , Did you get any error while building the cordova project?

osamax2 commented 5 years ago

Hi @osamax2 , Did you get any error while building the cordova project?

no I don't cordova build android ` Failed to patch the file : "/home/slimane/AVGDashboardMobile/platforms/android/app/src/main/assets/www/nodejs-project/node_modules/@schematics/angular/workspace/files/package.json". The following error was thrown: {} Failed to patch the file : "/home/slimane/AVGDashboardMobile/platforms/android/app/src/main/assets/www/nodejs-project/node_modules/@schematics/angular/workspace/files/package.json". The following error was thrown: {} Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=/home/slimane/Android/ (DEPRECATED) Subproject Path: CordovaLib Subproject Path: CordovaLib Subproject Path: CordovaLib Subproject Path: CordovaLib Subproject Path: CordovaLib Subproject Path: app Subproject Path: app Subproject Path: app Subproject Path: app Subproject Path: app Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

Task :app:preBuild UP-TO-DATE Task :CordovaLib:preBuild UP-TO-DATE Task :CordovaLib:preDebugBuild UP-TO-DATE Task :CordovaLib:checkDebugManifest UP-TO-DATE Task :CordovaLib:processDebugManifest UP-TO-DATE Task :app:preDebugBuild UP-TO-DATE Task :CordovaLib:compileDebugAidl NO-SOURCE Task :app:compileDebugAidl NO-SOURCE Task :CordovaLib:packageDebugRenderscript NO-SOURCE Task :app:compileDebugRenderscript UP-TO-DATE Task :app:checkDebugManifest UP-TO-DATE Task :app:generateDebugBuildConfig UP-TO-DATE Task :app:prepareLintJar UP-TO-DATE Task :app:generateDebugSources UP-TO-DATE Task :CordovaLib:compileDebugRenderscript UP-TO-DATE Task :CordovaLib:generateDebugBuildConfig UP-TO-DATE Task :CordovaLib:generateDebugResValues UP-TO-DATE Task :CordovaLib:generateDebugResources UP-TO-DATE Task :CordovaLib:packageDebugResources UP-TO-DATE Task :CordovaLib:generateDebugRFile UP-TO-DATE Task :CordovaLib:prepareLintJar UP-TO-DATE Task :CordovaLib:generateDebugSources UP-TO-DATE Task :CordovaLib:javaPreCompileDebug UP-TO-DATE Task :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE Task :CordovaLib:processDebugJavaRes NO-SOURCE Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE Task :app:javaPreCompileDebug UP-TO-DATE Task :app:mainApkListPersistenceDebug UP-TO-DATE Task :app:generateDebugResValues UP-TO-DATE Task :app:generateDebugResources UP-TO-DATE Task :app:mergeDebugResources UP-TO-DATE Task :app:createDebugCompatibleScreenManifests UP-TO-DATE Task :app:processDebugManifest Task :app:processDebugResources Task :app:compileDebugJavaWithJavac UP-TO-DATE Task :app:compileDebugNdk NO-SOURCE Task :app:compileDebugSources UP-TO-DATE Task :app:mergeDebugShaders UP-TO-DATE Task :app:compileDebugShaders UP-TO-DATE Task :app:generateDebugAssets UP-TO-DATE Task :CordovaLib:mergeDebugShaders UP-TO-DATE Task :CordovaLib:compileDebugShaders UP-TO-DATE Task :CordovaLib:generateDebugAssets UP-TO-DATE Task :CordovaLib:packageDebugAssets UP-TO-DATE Task :app:mergeDebugAssets Task :app:validateSigningDebug UP-TO-DATE Task :app:signingConfigWriterDebug UP-TO-DATE Task :app:transformClassesWithDexBuilderForDebug Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug Task :app:transformDexArchiveWithDexMergerForDebug Task :app:mergeDebugJniLibFolders UP-TO-DATE Task :CordovaLib:compileDebugNdk NO-SOURCE Task :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE Task :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE Task :CordovaLib:transformNativeLibsWithStripDebugSymbolForDebug UP-TO-DATE Task :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE Task :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE Task :app:transformNativeLibsWithStripDebugSymbolForDebug UP-TO-DATE Task :app:processDebugJavaRes NO-SOURCE Task :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE Task :app:packageDebug Task :app:assembleDebug Task :app:cdvBuildDebug

BUILD SUCCESSFUL in 1m 28s 44 actionable tasks: 7 executed, 37 up-to-date Built the following apk(s): /home/slimane/AVGDashboardMobile/platforms/android/app/build/outputs/apk/debug/app-debug.apk Built the following apk(s): /home/slimane/AVGDashboardMobile/platforms/android/app/build/outputs/apk/debug/app-debug.apk Built the following apk(s): /home/slimane/AVGDashboardMobile/platforms/android/app/build/outputs/apk/debug/app-debug.apk Built the following apk(s): /home/slimane/AVGDashboardMobile/platforms/android/app/build/outputs/apk/debug/app-debug.apk Built the following apk(s): /home/slimane/AVGDashboardMobile/platforms/android/app/build/outputs/apk/debug/app-debug.apk `

jaimecbernardo commented 5 years ago

Hi @osamax2 ,

Can't be sure of what it might be, since there are some suspicious details about the log:

To check if this might be something related to the development environment and not the project, would you mind checking if you are able to build and run the "Usage" project from the README? https://github.com/JaneaSystems/nodejs-mobile-cordova/tree/823fe002e8312e3abba76f9b8aa358a490f76eac#usage

robcifre commented 4 years ago

I am also having the same problems with nodejs no defined. What do I need to do to get you all the info you need on my setup? Please help, been at this for days trying to get this to work.

jaimecbernardo commented 4 years ago

Reproduction steps would be the way to go. How is the project created? Can you share a repo with instructions on how to run?

robcifre commented 4 years ago

Ok I added you. Thank you so much!

jaimecbernardo commented 4 years ago

Hi @robcifre , You just added me to a private repo. I won't be able to look at it. Could you please share a simple repo that's able to reproduce this error that's visible publicly? Or also try with a simpler sample to see if it's a configuration issue in your machine.