Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning: Error: spawn EACCES #21

Open
cerw opened this issue Apr 8, 2018 · 19 comments
Open

UnhandledPromiseRejectionWarning: Error: spawn EACCES #21

cerw opened this issue Apr 8, 2018 · 19 comments

Comments

@cerw
Copy link

cerw commented Apr 8, 2018

Hello,

When I download your repo and run

npm install
cordova platform add android

all seem fine but having issue with :

cordova run android
ANDROID_HOME=/Users/cerw/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
(node:43973) UnhandledPromiseRejectionWarning: Error: spawn EACCES
    at ChildProcess.spawn (internal/child_process.js:330:11)
    at Object.exports.spawn (child_process.js:500:9)
    at Object.exports.spawn (/Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:134:31)
    at GradleBuilder.runGradleWrapper (/Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/lib/builders/GradleBuilder.js:78:27)
    at /Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/lib/builders/GradleBuilder.js:177:21
    at _fulfilled (/Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/node_modules/q/q.js:816:13)
    at /Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/node_modules/q/q.js:570:49
    at runSingle (/Users/cerw/Work/slsa/mapbox-gl-cordova-offline-master/platforms/android/cordova/node_modules/q/q.js:137:13)
(node:43973) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:43973) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm --version
n5.6.0
node --version
v9.7.1
MacOS: 10.13.3

Any idea?
Thanks

@bg-wa
Copy link

bg-wa commented Apr 10, 2018

Did you add the plugins listed in the docs?

  • "cordova-plugin-device"
  • "cordova-plugin-file"
  • "cordova-sqlite-ext"

@cerw
Copy link
Author

cerw commented Apr 11, 2018

I woudl thing running cordova platform add android did the job?


└─(~/Work/slsa/mapbox-gl-cordova-offline-master)─(10 files, 1928b)─> cordova platform add android
Using cordova-fetch for [email protected]
Adding android project...
Creating Cordova project for the Android platform:
	Path: platforms/android
	Package: co.geomati.mapboxGLCordovaOffline
	Name: Mapbox_GL_Cordova_Offline
	Activity: MainActivity
	Android target: android-26
Subproject Path: CordovaLib
Android project created with [email protected]
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "cordova-plugin-file" in config.xml. Adding it to the project
Installing "cordova-plugin-file" for android

The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.

Adding cordova-plugin-file to package.json
Saved plugin info for "cordova-plugin-file" to config.xml
Discovered plugin "cordova-sqlite-ext" in config.xml. Adding it to the project
Installing "cordova-sqlite-ext" for android
installing external dependencies via npm
npm install of external dependencies ok
Adding cordova-sqlite-ext to package.json
Saved plugin info for "cordova-sqlite-ext" to config.xml
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
--save flag or autosave detected
Saving android@~6.3.0 into config.xml file ...

@bg-wa
Copy link

bg-wa commented Apr 11, 2018

Yep, looks good! Can you open the project in android studio and run it manually? I feel like I ran into this a while back and it was a problem with gradle.
I've got this running successfully on Android, so I can say it does work with the latest version of cordova...

@cerw
Copy link
Author

cerw commented Apr 11, 2018

It prompted me to upgrade to Gradle 3.1.0 so doing that now.
I will try just create new cordova project and only include the libs and plugins i need. it shoudl compile fine i guess...

@cerw
Copy link
Author

cerw commented Apr 11, 2018

Hmm Android Studio did not work either :(

Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'debugCompile' is obsolete and has been replaced with 'debugImplementation'.
It will be removed at the end of 2018


Configuration 'releaseCompile' is obsolete and has been replaced with 'releaseImplementation'.
It will be removed at the end of 2018


Unable to resolve dependency for ':@debug/compileClasspath': Could not resolve project :CordovaLib.
Open File
Show Details


Unable to resolve dependency for ':@debugAndroidTest/compileClasspath': Could not resolve project :CordovaLib.
Open File
Show Details


Unable to resolve dependency for ':@debugUnitTest/compileClasspath': Could not resolve project :CordovaLib.
Open File
Show Details


Unable to resolve dependency for ':@release/compileClasspath': Could not resolve project :CordovaLib.
Open File
Show Details


Unable to resolve dependency for ':@releaseUnitTest/compileClasspath': Could not resolve project :CordovaLib.
Open File
Show Details

@cerw
Copy link
Author

cerw commented Apr 11, 2018

IOS

─(~/Work/slsa/mapbox-gl-cordova-offline-master)─(12 files, 1936b)─> cordova run ios
Discovered platform "[email protected]" in config.xml or package.json. Adding it to the project
Using cordova-fetch for [email protected]
Adding ios project...
Creating Cordova project for the iOS platform:
	Path: platforms/ios
	Package: co.geomati.mapboxGLCordovaOffline
	Name: Mapbox GL Cordova Offline
iOS project created with [email protected]
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-file" for ios
Installing "cordova-plugin-whitelist" for ios
Installing "cordova-sqlite-ext" for ios
installing external dependencies via npm
npm install of external dependencies ok
(node:39454) UnhandledPromiseRejectionWarning: Error: Command failed: xcrun simctl list --json
dyld: Symbol not found: _SimDeviceBootKeyDisabledJobs
  Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/simctl
  Expected in: /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator
 in /Applications/Xcode.app/Contents/Developer/usr/bin/simctl

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:127:13)
    at maybeClose (internal/child_process.js:936:16)
    at Socket.stream.socket.on (internal/child_process.js:353:11)
    at Socket.emit (events.js:127:13)
    at Pipe._handle.close [as _onclose] (net.js:558:12)
(node:39454) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:39454) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@cerw
Copy link
Author

cerw commented Apr 11, 2018

When i craeted new project, and just copy the www over i manage to get it compilied. but now I get
Failed to initialize WebG Do you need to run Crosswalk or how do you get it to run ?

@bg-wa
Copy link

bg-wa commented Apr 11, 2018

I didn't need to use crosswalk on Android, but I did change ln.42 from }).then((map) => { to }).then(function(map){

Howver, I'm getting CORS errors on iOS loading the map tiles ( issue #20 )

@cerw
Copy link
Author

cerw commented Apr 12, 2018

On IOS the app wont even run just dies after executing it.

No target specified for emulator. Deploying to iPhone-4s, 9.3 simulator
An error was encountered processing the command (domain=FBSOpenApplicationErrorDomain, code=1):
The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.)
io.cordova.hellocordova: -1
logPath: /Users/cerw/Work/slsa/mapOfflineCordova/platforms/ios/cordova/console.log

And there is no console.log file either :(

@cerw
Copy link
Author

cerw commented Apr 12, 2018

Turns out it's new Xcode 9.3 issue you can make it run using

cordova run ios -l --target="iPhone-X"

!

@bg-wa
Copy link

bg-wa commented Apr 12, 2018

Cool! And are you able to view the map on iOS? I just get an empty map container with controls, but no tiles...

@cerw
Copy link
Author

cerw commented Apr 12, 2018

IOS

image

Android
image

It seem the Android can not detect WebGL and complains about it, but the WebView def has WebGL support ( goging to http://html5test.com/s/823f29378ed7958e.html show it's ON)

@bg-wa
Copy link

bg-wa commented Apr 12, 2018

Ha, this whole time I was testing iOS on an actual device... when I boot to the emulator (or a newer device) I get the correct results! (UGH... I wasted a whole week on this!!) So I'm testing android on a 7.0 device. What OS version is your android emulator set to?

@cerw
Copy link
Author

cerw commented Apr 12, 2018

I am testing Pixel_2_API_26

@bg-wa
Copy link

bg-wa commented Apr 12, 2018

I just tested Pixel_2_API_26 and get your same results... the same code works on my device. is webgl disabled on emulators? I don't have any other android devices to test on right now.

@cerw
Copy link
Author

cerw commented Apr 12, 2018

Its not disable use DevTool to go to http://html5test.com/s/823f29378ed7958e.html in the same Cordova WebView and you will see its ON.

@cerw
Copy link
Author

cerw commented Apr 12, 2018

I can confirm it works on real device Pixel 1 👍

oscarfonts added a commit that referenced this issue Apr 13, 2018
@oscarfonts
Copy link
Owner

I just added a comment to the README file stating that the android emulator doesn't display webgl content. Also replaced the arrow function in https://github.com/oscarfonts/mapbox-gl-cordova-offline/blob/master/www/index.html#L42

About the iOS issue. I have little iOS experience and no real device. I understand it has to do with some specific iOS or hardware version, but don't get exactly which ones. Could you state exactly in which environment the error arises and how did you overcome it? Thanks!

@bg-wa
Copy link

bg-wa commented Apr 13, 2018

I'll do some more testing after the weekend, but it looks like iOS 10 is the minimum version (hardware & emulator).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants