maxence-lefebvre / docker-forcedroid

MIT License
0 stars 0 forks source link

Cordova doesn't find environment variables #3

Open maxence-lefebvre opened 7 years ago

maxence-lefebvre commented 7 years ago
vagrant@vagrant-ubuntu-trusty-64:/vagrant/apps$ sudo forcedroid create
Enter your application type (native, react_native, hybrid_local, hybrid_remote): hybrid_remote
Enter your application name: TrailheadHybridTest
Enter the package name for your app (com.mycompany.myapp): com.lfbvr.trailheadhybridtest
Enter your organization name (Acme, Inc.): LFBVR, Inc.
Enter the start page for your app: /apex/HybridPage
Enter output directory for your app (leave empty for the current directory):

********************************************************************************
*
*   Creating android hybrid_remote application using Salesforce Mobile SDK
*     with app name:        TrailheadHybridTest
*          package name:    com.lfbvr.trailheadhybridtest
*          organization:    LFBVR, Inc.
*
*     in:                   TrailheadHybridTest
*
*     from template repo:   https://github.com/forcedotcom/SalesforceMobileSDK-Templates#v5.0.0
*          template path:   HybridRemoteTemplate
*          start page:      /apex/HybridPage
*          plugin repo:     https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v5.0.0
*
********************************************************************************

Using detached cordova-create
Creating a new cordova project.
/vagrant/apps/TrailheadHybridTest /vagrant/apps
/vagrant/apps/TrailheadHybridTest
└─┬ shelljs@0.7.0
  ├─┬ glob@7.1.1
  │ ├── fs.realpath@1.0.0
  │ ├─┬ inflight@1.0.6
  │ │ └── wrappy@1.0.2
  │ ├── inherits@2.0.3
  │ ├─┬ minimatch@3.0.3
  │ │ └─┬ brace-expansion@1.1.6
  │ │   ├── balanced-match@0.4.2
  │ │   └── concat-map@0.0.1
  │ ├── once@1.4.0
  │ └── path-is-absolute@1.0.1
  ├── interpret@1.0.1
  └─┬ rechoir@0.6.2
    └── resolve@1.2.0

/vagrant/apps
/vagrant/apps/TrailheadHybridTest /vagrant/apps
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: com.lfbvr.trailheadhybridtest
        Name: TrailheadHybridTest
        Activity: MainActivity
        Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.1.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android
Failed to install 'cordova-plugin-whitelist':Error
    at /vagrant/apps/TrailheadHybridTest/platforms/android/cordova/lib/check_reqs.js:222:19
    at _fulfilled (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:796:13)
    at /vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:857:14
    at runSingle (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:137:13)
    at flush (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
/vagrant/apps
/vagrant/apps/TrailheadHybridTest /vagrant/apps
support for subdirectories is deprecated and will be removed in Cordova@7
Fetching plugin "https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin" via git clone
Repository "https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin" checked out to git ref "v5.0.0".
Installing "com.salesforce" for android
Installing "cordova-plugin-whitelist" for android
Failed to install 'cordova-plugin-whitelist':Error
    at /vagrant/apps/TrailheadHybridTest/platforms/android/cordova/lib/check_reqs.js:222:19
    at _fulfilled (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:796:13)
    at /vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:857:14
    at runSingle (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:137:13)
    at flush (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Failed to install 'com.salesforce':Error
    at /vagrant/apps/TrailheadHybridTest/platforms/android/cordova/lib/check_reqs.js:222:19
    at _fulfilled (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:796:13)
    at /vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:857:14
    at runSingle (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:137:13)
    at flush (/vagrant/apps/TrailheadHybridTest/platforms/android/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
/vagrant/apps
forcedroid create failed

Command failed: cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v5.0.0 --force
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

And yet

vagrant@vagrant-ubuntu-trusty-64:/vagrant/apps$ echo $ANDROID_HOME
/opt/android/android-sdk-linux
vagrant@vagrant-ubuntu-trusty-64:/vagrant/apps$ which android
/opt/android/android-sdk-linux/tools/android
maxence-lefebvre commented 7 years ago

This is because of sudo forcedroid create and env_reset, secure_path entries in sudoers file.

Looking into puppet-sudo