TooTallNate / node-speaker

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

Installation Error om mac M2 #177

Open kamalkech opened 9 months ago

kamalkech commented 9 months ago
 gyp: name 'mpg123_cpu' is not defined while evaluating condition 'mpg123_cpu=="arm_nofpu"' in deps/mpg123/mpg123.gyp while loading dependencies o
│ gyp ERR! configure error 
│ gyp ERR! stack Error: `gyp` failed with exit code: 1
│ gyp ERR! stack     at ChildProcess.onCpExit (/Users/myuser/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/node_modules/node-gyp/lib/con
│ gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
│ gyp ERR! System Darwin 23.0.0
│ gyp ERR! command "/Users/myuser/.nvm/versions/node/v18.16.0/bin/node" "/Users/myuser/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/n
│ gyp ERR! cwd /Users/myuser/Projects/DyaliCode/AI/ai-voice/node_modules/.pnpm/speaker@0.5.4/node_modules/speaker
│ gyp ERR! node -v v18.16.0
│ gyp ERR! node-gyp -v v9.3.1
│ gyp ERR! not ok 

any idea ??

adnikiforov commented 8 months ago

I've found solution, at least it is working locally, but if you need this as a dependency, you may need some extra steps.

Add to deps/mpg123/mpg123.gyp at variables block (line 11)

'mpg123_cpu%': '',

Then copy deps/mpg123/config/linux/arm to deps/mpg123/config/mac and rename newly copied directory to arm64

Then you can try and run node-gyp configure and node-gyp build or just npm install . from the root. At this point you should have working node-speaker library.

Again, if you need to use as dependency, you might need to run npm link %path_to_node_speaker% from your app root in order for your app to use locally built node-speaker and not remote one.

Hope that helps! I might open PR later.

adnikiforov commented 8 months ago

Actually, there is PR already https://github.com/TooTallNate/node-speaker/pull/178/files