我想在我的nodejs脚本上播放一些音乐。我尝试用npm安装player模块。
但是当我启动安装时,他们会返回:
speaker@0.2.1 install /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/speaker
> node-gyp rebuild
make: entrant dans le répertoire « /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/speaker/build »
CC(target) Release/obj.target/output/deps/mpg123/src/output/alsa.o
../deps/mpg123/src/output/alsa.c:19:28: fatal error: alsa/asoundlib.h: Aucun fichier ou dossier de ce type
#include <alsa/asoundlib.h>
^
compilation terminated.
make: *** [Release/obj.target/output/deps/mpg123/src/output/alsa.o] Erreur 1
make: quittant le répertoire « /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/speaker/build »
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/tr*****/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-49-generic
gyp ERR! command "node" "/home/tr*****/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/speaker
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
> lame@1.1.1 install /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/lame
> node-gyp rebuild
make: entrant dans le répertoire « /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/lame/build »
deps/mpg123/test.target.mk:117: attention : écrasement des commandes pour la cible « Release/test »
deps/lame/test.target.mk:125: attention : anciennes commandes ignorées pour la cible « Release/test »
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/VbrTag.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/bitstream.o
../deps/lame/libmp3lame/bitstream.c: In function ‘do_gain_analysis’:
../deps/lame/libmp3lame/bitstream.c:992:24: warning: unused variable ‘rov’ [-Wunused-variable]
RpgResult_t *const rov = &gfc->ov_rpg;
^
../deps/lame/libmp3lame/bitstream.c:991:32: warning: unused variable ‘rsv’ [-Wunused-variable]
RpgStateVar_t const *const rsv = &gfc->sv_rpg;
^
../deps/lame/libmp3lame/bitstream.c:990:34: warning: unused variable ‘cfg’ [-Wunused-variable]
SessionConfig_t const *const cfg = &gfc->cfg;
^
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/encoder.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/fft.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/gain_analysis.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/id3tag.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/lame.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/newmdct.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/presets.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/psymodel.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/quantize.o
../deps/lame/libmp3lame/quantize.c: In function ‘VBR_new_iteration_loop’:
../deps/lame/libmp3lame/quantize.c:1734:28: warning: variable ‘fullframebits’ set but not used [-Wunused-but-set-variable]
int mean_bits, fullframebits;
^
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/quantize_pvt.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/reservoir.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/set_get.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/tables.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/takehiro.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/util.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/vbrquantize.o
CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/version.o
AR(target) Release/obj.target/deps/lame/libmp3lame.a
COPY Release/libmp3lame.a
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/compat.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/parse.o
../deps/mpg123/src/libmpg123/parse.c: In function ‘handle_id3v2’:
../deps/mpg123/src/libmpg123/parse.c:1013:31: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
else debug("no useful ID3v2");
^
../deps/mpg123/src/libmpg123/parse.c: In function ‘skip_junk’:
../deps/mpg123/src/libmpg123/parse.c:1081:71: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
else debug1("hopefully found one at %"OFF_P, (off_p)fr->rd->tell(fr));
^
../deps/mpg123/src/libmpg123/parse.c: In function ‘wetwork’:
../deps/mpg123/src/libmpg123/parse.c:1149:114: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
if(VERBOSE3) debug3("resync try %li at %"OFF_P", got newhead 0x%08lx", try, (off_p)fr->rd->tell(fr), newhead);
^
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/frame.o
../deps/mpg123/src/libmpg123/frame.c: In function ‘INT123_frame_outbuffer’:
../deps/mpg123/src/libmpg123/frame.c:184:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘size_t’ [-Wformat=]
if(NOQUIET) error2("have external buffer of size %"SIZE_P", need %"SIZE_P, (size_p)fr->buffer.size, size);
^
../deps/mpg123/src/libmpg123/frame.c: In function ‘INT123_frame_buffers’:
../deps/mpg123/src/libmpg123/frame.c:285:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(2*2*0x110*sizeof(real) > buffssize)
^
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/format.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/dct64.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/equalizer.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/id3.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/optimize.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/readers.o
../deps/mpg123/src/libmpg123/readers.c: In function ‘plain_read’:
../deps/mpg123/src/libmpg123/readers.c:60:70: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
if(VERBOSE3) debug2("read %li bytes of %li", (long)ret, (long)count);
^
../deps/mpg123/src/libmpg123/readers.c: In function ‘bc_add’:
../deps/mpg123/src/libmpg123/readers.c:630:93: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
if(size >=4) debug4("first bytes: %02x %02x %02x %02x", data[0], data[1], data[2], data[3]);
^
../deps/mpg123/src/libmpg123/readers.c: In function ‘bc_forget’:
../deps/mpg123/src/libmpg123/readers.c:728:42: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
else debug("forget with nothing there!");
^
../deps/mpg123/src/libmpg123/readers.c: In function ‘INT123_feed_more’:
../deps/mpg123/src/libmpg123/readers.c:763:33: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
if(VERBOSE3) debug("feed_more");
^
../deps/mpg123/src/libmpg123/readers.c:772:82: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
(unsigned long)fr->rdat.buffer.last->size, (unsigned long)fr->rdat.buffer.size);
^
../deps/mpg123/src/libmpg123/readers.c: In function ‘buffered_fullread’:
../deps/mpg123/src/libmpg123/readers.c:848:97: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
if(VERBOSE3) debug1("buffered_fullread: buffering %li bytes from stream (if > 0)", (long)got);
^
../deps/mpg123/src/libmpg123/readers.c:856:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(got < sizeof(readbuf)) /* That naturally catches got == 0, too. */
^
../deps/mpg123/src/libmpg123/readers.c:867:73: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
if(VERBOSE3) debug2("wanted %li, got %li", (long)count, (long)gotcount);
^
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/tabinit.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/libmpg123.o
../deps/mpg123/src/libmpg123/libmpg123.c: In function ‘mpg123_plain_strerror’:
../deps/mpg123/src/libmpg123/libmpg123.c:1581:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(errcode >= 0 && errcode < sizeof(mpg123_error)/sizeof(char*))
^
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/index.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/stringbuf.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/icy.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/icy2utf8.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/ntom.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/synth.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/synth_8bit.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/layer1.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/layer2.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/layer3.o
../deps/mpg123/src/libmpg123/layer3.c: In function ‘III_dequantize_sample’:
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:804:6: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:818:6: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:842:6: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:890:4: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:1021:6: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:1036:6: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:1059:6: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
../deps/mpg123/src/libmpg123/layer3.c:695:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(num < BITSHIFT) { \
^
../deps/mpg123/src/libmpg123/layer3.c:1088:4: note: in expansion of macro ‘REFRESH_MASK’
REFRESH_MASK;
^
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/feature.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/synth_s32.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/synth_real.o
CC(target) Release/obj.target/mpg123/deps/mpg123/src/libmpg123/dct64_i386.o
AR(target) Release/obj.target/deps/mpg123/libmpg123.a
COPY Release/libmpg123.a
CC(target) Release/obj.target/lamevectorroutines/deps/lame/libmp3lame/vector/xmm_quantize_sub.o
AR(target) Release/obj.target/deps/lame/liblamevectorroutines.a
COPY Release/liblamevectorroutines.a
CXX(target) Release/obj.target/bindings/src/bindings.o
In file included from ../src/bindings.cc:17:0:
/home/tr*****/.node-gyp/0.12.2/deps/v8/include/v8.h: In function ‘void nodelame::Initialize(v8::Handle<v8::Object>)’:
/home/tr*****/.node-gyp/0.12.2/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
V8_INLINE HandleScope() {}
^
../src/bindings.cc:29:15: error: within this context
HandleScope scope;
^
make: *** [Release/obj.target/bindings/src/bindings.o] Erreur 1
make: quittant le répertoire « /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/lame/build »
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/tr*****/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-49-generic
gyp ERR! command "node" "/home/tr*****/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/tr*****/Documents/Programation/Node.js/node_modules/player/node_modules/lame
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "node" "/home/tr*****/.nvm/versions/node/v0.12.2/bin/npm" "install" "player"
npm ERR! node v0.12.2
npm ERR! npm v2.8.3
npm ERR! code ELIFECYCLE
npm ERR! speaker@0.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the speaker@0.2.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the speaker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls speaker
npm ERR! There is likely additional logging output above.
你能帮助我,还是你知道另一个播放音乐的模块 谢谢
对不起我是法国人的错误
答案 0 :(得分:0)
你是否在npm安装之前安装了libasound2-dev
?在Debian / Ubuntu上,这似乎是必要的,这就是为什么你的安装缺少alsa / asoundlib.h头文件。
在终端上运行sudo apt-get install libasound2-dev
,然后尝试重新安装播放器。
来源:https://github.com/turingou/player/issues/35#issuecomment-84525573