簡體   English   中英

無法連接到 meteor 上的托管或本地 mongo

[英]can't connect to hosted or local mongo on meteor android-device

基本上,在meteor run android-device上運行時,我無法讓本地或托管的 mongo 連接到我的應用程序。 只需meteor run ,本地和托管都可以正常工作。 我也無法讓它在為測試 Play 商店發布的應用程序上運行,但我假設一旦我能夠在本地運行我托管的 mongo,我應該能夠將這些修復應用到已發布的版本。 我正在運行 ubuntu 18.04。


在我的 android 手機上進行本地測試時連接到我的本地 mongo:
所以從我在線閱讀的內容來看,設備和計算機需要在同一個wifi網絡上,我需要聲明--mobile-server。 我的手機處於飛行模式,連接到 wifi 網絡並插入我的筆記本電腦進行測試。 我不認為這是防火牆問題,因為我有其他硬件我正在以這種方式連接到工作。 這些是我嘗試過的各種腳本,但沒有一個工作。 我完全不知所措。 我正在運行最新的 meteor。 我也在模擬器上嘗試過任何粗體字。

"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.102" <-- ip 我的筆記本電腦在我的wifi網絡上的地址

"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.102:3000"

"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server locahost:3000"

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server locahost:27017”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1:27017”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1:3000”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.109” <-- ip address of my phone on my wifi network

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.109:3000”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server localhost:12816” <-- chrome's remote debugging url


連接到我托管的 mongo (mongodb.com)
我確實知道這里的--mobile-server將是一個托管您的應用程序的在線服務器,但這就是我感到困惑的地方……如果它托管在 Play 商店中,這到底是什么意思? 我有一個個人網站(在 google 上注冊的域,托管在 aws amplify 上),為此我使用了一個子域。

我已完成本指南https://sergelobatch.com/beginners-guide-to-deploying-a-meteor-app-to-an-aws-server-with-meteor-up/並能夠通過以下方式訪問應用程序通過我的 web 瀏覽器訪問 ec2 公共 ipv4 地址和子域,它按預期從數據庫中提取數據。 我已經允許我的 ec2 的公共 ipv4 訪問我的 mongodb 網絡。 (旁注,不是 https,這有關系嗎?)

再次在本地運行我已經嘗試過這些,仍然沒有運氣:

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server <ec2_public_ipv4>:80”

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server <ec2_public_ipv4>:3000”

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server http://<ec2_public_ipv4>:80”

^^^ 我已經嘗試了以上所有方法 ROOT_URL=sub.domain.com

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server sub.domain.com”

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server sub.domain.com:80”


更新:我確實看到我沒有找到一些 cordova 資產。 即使在手動添加這些包之后,這些仍然存在。


I20200624-01:28:29.236(-7)? 06-24 01:28:27.889  6311  6393 W MeteorWebApp: Asset /cordova_plugins.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle

I20200624-01:28:29.236(-7)? 06-24 01:28:27.914  6311  6401 W MeteorWebApp: Asset /plugins/cordova-plugin-splashscreen/www/splashscreen.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle

I20200624-01:28:29.236(-7)? 06-24 01:28:27.914  6311  6404 W MeteorWebApp: Asset /plugins/cordova-plugin-meteor-webapp/www/webapp_local_server.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle

I20200624-01:28:29.236(-7)? 06-24 01:28:27.915  6311  6393 W MeteorWebApp: Asset /plugins/cordova-plugin-statusbar/www/statusbar.js not found in bundle



移動配置.js

    App.info({
        //
    });
    
    App.icons({
      'android_mdpi': 'resources/icons/icon-48x48.png',
      'android_hdpi': 'resources/icons/icon-72x72.png',
      'android_xhdpi': 'resources/icons/icon-96x96.png',
      'android_xxhdpi': 'resources/icons/icon-148x148.png',
      'android_xxxhdpi': 'resources/icons/icon-192x192.png'
    });
    
    App.launchScreens({
      // Android
      'android_mdpi_portrait': 'resources/splash/splash-320x480.png',
      'android_mdpi_landscape': 'resources/splash/splash-480x320.png',
      'android_hdpi_portrait': 'resources/splash/splash-480x800.png',
      'android_hdpi_landscape': 'resources/splash/splash-800x480.png',
      'android_xhdpi_portrait': 'resources/splash/splash-720x1280.png',
      'android_xhdpi_landscape': 'resources/splash/splash-1280x720.png'
    });
    
    App.accessRule("*");
    App.accessRule("http://")
    App.accessRule("https://")
    App.accessRule("http://localhost:*")
    App.accessRule("http://127.0.0.1:*")
    App.accessRule("http://127.0.0.1")
    App.accessRule('http://localhost:3000/*');
    App.accessRule('http://192.168.1.109:3000/*');
    App.accessRule('http://192.168.1.102:3000/*');
    App.accessRule('http://<subdomain>.<domain>.com/*');
    App.accessRule('http://localhost:3000/*');
    App.accessRule('http://<ec2 public ipv4>/*');
    App.accessRule('http://<ec2 public ipv4>:*');

以供將來參考:修復是通過https://docs.meteor.com/packages/autoupdate.html添加自動更新和必要的配置和運行 dev 與標志--mobile server <ec2-public-ipv4>:80使用--server <ec2-public-ipv4>:80構建

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM