我需要 ffmpeg-binaries 来通过语音通道使用我的 discord 机器人播放音频文件,但是 npm 只返回一个错误。
错误信息:
C:\Users\malte>npm install ffmpeg-binaries --save
> [email protected] install C:\Users\malte\node_modules\lzma-native
> node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build
node-pre-gyp ERR! Tried to download(404): https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.8-node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.8-node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\malte\AppData\Local\Programs\Python\Python36-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\malte\\node_modules\\lzma-native\\binding-v3.0.8-node-v67-win32-x64\\lzma_native.node" "--module_name=lzma_native" "--module_path=C:\\Users\\malte\\node_modules\\lzma-native\\binding-v3.0.8-node-v67-win32-x64"
gyp ERR! cwd C:\Users\malte\node_modules\lzma-native
gyp ERR! node -v v11.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\malte\AppData\Local\Programs\Python\Python36-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gypnode-pre-gyp ERR!ERR! build errorstack
node-pre-gypgyp ERR!ERR! stackstack at ChildProcess.exithandler (child_process.js:289:12)
Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\malte\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64\lzma_native.node --module_name=lzma_native --module_path=C:\Users\malte\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64' (1)
gypnode-pre-gyp ERR! ERR!stack at ChildProcess.<anonymous> (C:\Users\malte\node_modules\lzma-native\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp gypERR! ERR!stack at ChildProcess.emit (events.js:182:13)
stacknode-pre-gyp at maybeClose (internal/child_process.js:970:16)
gyp ERR!ERR! stackstack at maybeClose (internal/child_process.js:970:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
node-pre-gyp ERR!gyp stackERR! at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
node-pre-gyp ERR! SystemSystem Windows_NT 10.0.17134
Windows_NT 10.0.17134
gyp ERR! node-pre-gypcommand "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\malte\\node_modules\\lzma-native\\binding-v3.0.8-node-v67-win32-x64\\lzma_native.node" "--module_name=lzma_native" "--module_path=C:\\Users\\malte\\node_modules\\lzma-native\\binding-v3.0.8-node-v67-win32-x64"
ERR! gypcommand "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\malte\\node_modules\\lzma-native\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
ERR!node-pre-gyp cwdERR! C:\Users\malte\node_modules\lzma-native
gypcwd C:\Users\malte\node_modules\lzma-native
ERR!node-pre-gyp node -vERR! v11.1.0
node -vgyp v11.1.0
ERR!node-pre-gyp node-gyp -vERR! v3.8.0
node-pre-gyp -vgyp v0.6.39
node-pre-gyp ERR!ERR! not oknot ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\malte\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64\lzma_native.node --module_name=lzma_native --module_path=C:\Users\malte\node_modules\lzma-native\binding-v3.0.8-node-v67-win32-x64' (1)
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\malte\package.json'
npm WARN [email protected] requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN malte No description
npm WARN malte No repository field.
npm WARN malte No README data
npm WARN malte No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\malte\AppData\Roaming\npm-cache\_logs\2019-01-05T18_39_28_480Z-debug.log
我使用的是 64 位架构的 Windows 10。我还没有看到互联网上其他人遇到过此错误。如果你去https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.8-node-v67-win32-x64.tar.gz(如错误所示)显示 404。我认为这是导致错误发生的原因,但我不知道如何修复它。discord.js 和无描述、存储库字段、自述文件数据、许可证警告可能无关紧要,因为它们每次我使用 npm 安装 api 时都会发生。据我所知,我无法修复它们,而且它不会产生任何影响。错误中提到的完整日志如下:
(它太大了,放不下)
答案1
只需安装另一个名为 ffbinaries 的 API,它实际上可以工作