问题
I am trying to install node-serialport package using:
nmp install serialport
But unfortunately its not working, the version os nodejs installed in 10.0.0-1. Following is the error message I get:
[user@home ~]$ npm install serialport
npm http GET https://registry.npmjs.org/serialport
npm http 304 https://registry.npmjs.org/serialport
npm http GET https://registry.npmjs.org/sf/0.1.3
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/node-gyp/0.6.2
npm http GET https://registry.npmjs.org/bindings/0.3.0
npm http GET https://registry.npmjs.org/async/0.1.18
npm http 304 https://registry.npmjs.org/async/0.1.18
npm http 304 https://registry.npmjs.org/bindings/0.3.0
npm http 304 https://registry.npmjs.org/node-gyp/0.6.2
npm http 304 https://registry.npmjs.org/sf/0.1.3
npm http 304 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/npmlog
npm http GET https://registry.npmjs.org/osenv
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/npmlog
npm http 304 https://registry.npmjs.org/osenv
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/semver
npm http 304 https://registry.npmjs.org/tar
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/ansi
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/ansi
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/sigmund
> serialport@1.0.8 install /home/user/node_modules/serialport
> node-gyp rebuild
make: Entering directory `/home/user/node_modules/serialport/build'
CXX(target) Release/obj.target/serialport/src/serialport.o
../src/serialport.cpp: In function ‘v8::Handle<v8::Value> Open(const v8::Arguments&)’:
../src/serialport.cpp:51:64: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
In file included from /home/user/.node-gyp/0.10.0/src/node.h:61:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:2:
/home/user/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/serialport.cpp: In function ‘v8::Handle<v8::Value> Write(const v8::Arguments&)’:
../src/serialport.cpp:118:82: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
In file included from /home/user/.node-gyp/0.10.0/src/node.h:61:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:2:
/home/user/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/serialport.cpp: In function ‘void EIO_AfterWrite(uv_work_t*)’:
../src/serialport.cpp:146:86: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
In file included from /home/user/.node-gyp/0.10.0/src/node.h:61:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:2:
/home/user/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/serialport.cpp: In function ‘v8::Handle<v8::Value> Close(const v8::Arguments&)’:
../src/serialport.cpp:178:66: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
In file included from /home/user/.node-gyp/0.10.0/src/node.h:61:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:2:
/home/user/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/serialport.cpp: In function ‘v8::Handle<v8::Value> List(const v8::Arguments&)’:
../src/serialport.cpp:214:64: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
In file included from /home/user/.node-gyp/0.10.0/src/node.h:61:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:2:
/home/user/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/serialport.cpp: In function ‘v8::Handle<v8::Value> Flush(const v8::Arguments&)’:
../src/serialport.cpp:271:66: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
In file included from /home/user/.node-gyp/0.10.0/src/node.h:61:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:2:
/home/user/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
make: Leaving directory `/home/user/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:256:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:754:12)
gyp ERR! System Linux 3.8.3-2-ARCH
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/user/node_modules/serialport
gyp ERR! node -v v0.10.0
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok
npm ERR! serialport@1.0.8 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the serialport@1.0.8 install script.
npm ERR! This is most likely a problem with the serialport 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 serialport
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.3-2-ARCH
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "serialport"
npm ERR! cwd /home/user
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/npm-debug.log
npm ERR! not ok code 0
回答1:
This bug has been reported. It is waiting to be deployed. See the instructions at the end of page.
来源:https://stackoverflow.com/questions/15549304/cant-install-node-serialport-on-linux