2011-07-12 91 views
1

當我嘗試運行NPM安裝串行端口時,出現此錯誤失敗。我可以安裝其他模塊,但不是串口。我對linux,node和npm缺乏經驗,需要一些關於這個問題的指導。使用NPM安裝節點串行端口的問題

這是在失敗的package.json命令

「CD serialport_native;節點-WAF配置構建; CP建立/默認/ serialport_native.node ../」

我有節點版本0.4 0.9和NPM版本1.0.15,並試圖安裝的SerialPort版本0.2.8

[email protected]:~$ npm install serialport 

> [email protected] install /home/administrator/node_modules/serialport 
> cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../ 

sh: node-waf: not found 
cp: cannot stat `build/default/serialport_native.node': No such file or directory 
npm ERR! error installing [email protected] Error: [email protected] install: `cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../` 
npm ERR! error installing [email protected] `sh "-c" "cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../"` failed with 1 
npm ERR! error installing [email protected]  at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20) 
npm ERR! error installing [email protected]  at ChildProcess.emit (events.js:67:17) 
npm ERR! error installing [email protected]  at ChildProcess.onexit (child_process.js:192:12) 
npm ERR! [email protected] install: `cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../` 
npm ERR! `sh "-c" "cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../"` failed with 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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!  cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../ 
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! 
npm ERR! System Linux 2.6.38-8-generic 
npm ERR! command "node" "/usr/bin/npm" "install" "serialport" 
npm ERR! cwd /home/administrator 
npm ERR! node -v v0.4.9 
npm ERR! npm -v 1.0.15 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /home/administrator/npm-debug.log 
npm not ok 

回答

0

我認爲voodootikigod's serialport

[email protected]:~/node/contact$ npm install serialport 

> [email protected] install /home/alfred/node_modules/serialport 
> cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../ 

Checking for program g++ or c++   : /usr/bin/g++ 
Checking for program cpp     : /usr/bin/cpp 
Checking for program ar     : /usr/bin/ar 
Checking for program ranlib    : /usr/bin/ranlib 
Checking for g++       : ok 
Checking for node path     : ok /home/alfred/.node_libraries 
Checking for node prefix     : ok /home/alfred/.nvm/v0.4.9 
'configure' finished successfully (0.555s) 
Waf: Entering directory `/home/alfred/node_modules/serialport/serialport_native/build' 
[1/2] cxx: serialport_native.cc -> build/default/serialport_native_1.o 
../serialport_native.cc:11: warning: extra tokens at end of #include directive 
[2/2] cxx_link: build/default/serialport_native_1.o -> build/default/serialport_native.node 
Waf: Leaving directory `/home/alfred/node_modules/serialport/serialport_native/build' 
'build' finished successfully (2.014s) 
[email protected] ../../node_modules/serialport 


[email protected]:~/node/contact$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu 
DISTRIB_RELEASE=10.10 
DISTRIB_CODENAME=maverick 
DISTRIB_DESCRIPTION="Ubuntu 10.10" 
[email protected]:~/node/contact$ node -v 
v0.4.9 
[email protected]:~/node/contact$ npm -v 
1.0.15 

非常奇怪,如果它不爲你安裝。你應該輸出完整的錯誤?

+1

我添加了上面的完整輸出。 – Ray

+1

奇怪的node-waf不在你的路徑中。我建議你重新安裝節點。也許使用nave => https://github.com/creationix/nvm進行安裝。我也運行節點作爲普通用戶,這可能是更安全的.. – Alfred

1

在某個程序中,看起來程序包二進制文件(至少在10.10)從node-waf更改爲nodejs-waf。如果使用「node-waf」獲得「Command not found」命令,請嘗試使用「nodejs-waf」。

0

我也有類似的問題得到serialport2與node.js 0.5工作。

在升級到node.js後得到了serialport2工作0.8+