Skip to content
This repository has been archived by the owner on Jan 3, 2022. It is now read-only.

UnhandledPromiseRejection #8

Open
cosmicparadox11 opened this issue May 11, 2021 · 10 comments
Open

UnhandledPromiseRejection #8

cosmicparadox11 opened this issue May 11, 2021 · 10 comments

Comments

@cosmicparadox11
Copy link

UnhandledPromiseRejectionWarning: Error: Command failed: powershell -c Add-Type -AssemblyName presentationCore; $player = New-Object system.windows.media.mediaplayer; $player.open('/home/sampath/.npm/_npx/1034/lib/node_modules/cowin-pinger/sounds/beep.mp3'); $player.Volume = 0.5; $player.Play(); Start-Sleep 1; Start-Sleep -s $player.NaturalDuration.TimeSpan.TotalSeconds;Exit;
/bin/sh: 1: Syntax error: word unexpected (expecting ")")

at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Socket.<anonymous> (internal/child_process.js:439:11)
at Socket.emit (events.js:315:20)
at Pipe.<anonymous> (net.js:673:12)
@abhinavdc
Copy link
Owner

This seems to be an error related to playing the notification sound when a slot is found. Can you trying running the script from Command Prompt instead of Powershell just to see if that's the cause of the issue.

@cosmicparadox11
Copy link
Author

i am running it on an ubuntu terminal

@abhinavdc
Copy link
Owner

Have you changed any code related to sound notification ? You could for the time being comment out the lines which play the notification sound and this should work.

@cosmicparadox11
Copy link
Author

i haven't made any changes

@abhinavdc
Copy link
Owner

Are you still getting this error, I kept this issue open to see if any other users face this same issue.

I have released new versions of the library so you could try running the latest versions and see if it fixes the issue you had.

@cosmicparadox11
Copy link
Author

still getting the same error

@Bhartendu-Kumar
Copy link

This error is in the latest version too.

Stopping Pinger...
(node:16758) UnhandledPromiseRejectionWarning: Error: Command failed: powershell -c Add-Type -AssemblyName presentationCore; $player = New-Object system.windows.media.mediaplayer; $player.open('/home/bhartendu/.npm/_npx/16758/lib/node_modules/cowin-pinger/sounds/beep.wav'); $player.Volume = 0.5; $player.Play(); Start-Sleep 1; Start-Sleep -s $player.NaturalDuration.TimeSpan.TotalSeconds;Exit;
/bin/sh: 1: Syntax error: word unexpected (expecting ")")

at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:970:16)
at Socket.stream.socket.on (internal/child_process.js:389:11)
at Socket.emit (events.js:189:13)
at Pipe._handle.close (net.js:600:12)

(node:16758) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch

@abhinavdc
Copy link
Owner

Can you clone the code and comment out these lines in the code

const sound = require("sound-play");
const path = require("path");
const notificationSound = path.join(__dirname, "sounds/beep.wav");

sound.play(notificationSound);

sound.play(notificationSound, 1);

Now try running npm i and then node app.js run --age=...

@joseph9991
Copy link
Contributor

The issue is happening because sound-play doesn't support Ubuntu / Linux-based OS.

image

@joseph9991
Copy link
Contributor

@abhinavdc I checked out node-wav-player. It is working fine on Ubuntu and Windows. Need to test it with macOS.

If you think it is worth upgrading, then I can work out the changes. Let me know!!

Usage:
const sound = require('node-wav-player');
sound.play({path: 'notificationSound'});

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

No branches or pull requests

4 participants