TooTallNate / node-speaker

Output PCM audio data to the speakers
648 stars 145 forks source link

Can't install: mpg123_cpu not defined #171

Closed carter293 closed 2 years ago

carter293 commented 2 years ago

Getting following error while trying to install package: npm ERR! gyp: name 'mpg123_cpu' is not defined while evaluating condition 'mpg123_cpu=="arm_nofpu"' in deps/mpg123/mpg123.gyp while loading dependencies of binding.gyp while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Darwin 21.3.0 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/***/node_modules/speaker npm ERR! gyp ERR! node -v v16.14.2 npm ERR! gyp ERR! node-gyp -v v9.0.0 npm ERR! gyp ERR! not ok

Running on Mac Monterey m1 chip

Warriorgiroro commented 2 years ago

Hi @carter293, Could you please share how u resolved the problem? many thanks.

carter293 commented 2 years ago

Hi @Warriorgiroro ! My apologies for not putting any comments on this. After a couple hour wasted - I opted for a different method of playing sound.

The context of my work was using AWS polly in a React app. I didn't want to download and then play the sound, so I instead used this:

function playAudio(data){ var uInt8Array = new Uint8Array(data.AudioStream) ; var arrayBuffer = uInt8Array.buffer; var blob = new Blob( [arrayBuffer]); var audio = document.getElementById('audio'); var url = URL.createObjectURL(blob) ; audio.src = url; return new Promise(res=>{ audio.play() audio.onended = res }) }

My apologies - I know this isn't the answer you were probably looking for, but I hope it helps in some way.