请教大神,在Node.js中如何获取系统麦克风里面的音频啊?在线等
@yjhjstz 这个包怎么安装不了啊?npm install 会报错,不知道你使用过没有?
难道是 node 版本问题, 试试其他版本
@yjhjstz 发现可能是安装环境不齐全,但是把提示需要安装的依赖包进行安装以后,到这一步怎么也跨不过去了,报错如下:
node-core-audio@0.5.0 install /home/neil/Projects/Nodejs/node_modules/node-core-audio
node-gyp rebuild
make: Entering directory `/home/neil/Projects/Nodejs/node_modules/node-core-audio/build’
CXX(target) Release/obj.target/NodeCoreAudio/NodeCoreAudio/AudioEngine.o
In file included from …/NodeCoreAudio/AudioEngine.h:11:0,
from ../NodeCoreAudio/AudioEngine.cpp:9:
/root/.node-gyp/5.0.0/include/node/node_internals.h:5:18: fatal error: util.h: No such file or directory
#include “util.h”
^
compilation terminated.
make: *** [Release/obj.target/NodeCoreAudio/NodeCoreAudio/AudioEngine.o] Error 1
make: Leaving directory /home/neil/Projects/Nodejs/node_modules/node-core-audio/build' gyp ERR! build error gyp ERR! stack Error:
make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "rebuild"
gyp ERR! cwd /home/neil/Projects/Nodejs/node_modules/node-core-audio
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN ENOENT ENOENT: no such file or directory, open '/home/neil/Projects/Nodejs/package.json’
npm WARN EPACKAGEJSON /home/neil/Projects/Nodejs No description
npm WARN EPACKAGEJSON /home/neil/Projects/Nodejs No repository field.
npm WARN EPACKAGEJSON /home/neil/Projects/Nodejs No README data
npm WARN EPACKAGEJSON /home/neil/Projects/Nodejs No license field.
npm ERR! Linux 3.13.0-32-generic
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” "node-core-audio"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code ELIFECYCLE
发现问题了,使用nvm工具把nodejs版本退回到0.10.45就可以安装了