首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用NPM安装node-serialport时出现问题

使用NPM安装node-serialport时出现问题
EN

Stack Overflow用户
提问于 2011-07-13 06:18:33
回答 3查看 4.6K关注 0票数 1

当我尝试运行NPM install serialport时,我得到了一个失败的错误信息。我可以很好地安装其他模块,但不能安装serialport。我对linux、node和npm相对缺乏经验,在这个问题上需要一些指导。

这是在package.json中失败的命令

"cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../“

我有node版本0.4.9和NPM版本1.0.15,正在尝试安装serialport版本0.2.8

代码语言:javascript
复制
administrator@ubuntu:~$ npm install serialport

> serialport@0.2.8 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 serialport@0.2.8 Error: serialport@0.2.8 install: `cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../`
npm ERR! error installing serialport@0.2.8 `sh "-c" "cd serialport_native;node-waf configure build;cp build/default/serialport_native.node ../"` failed with 1
npm ERR! error installing serialport@0.2.8     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing serialport@0.2.8     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing serialport@0.2.8     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! serialport@0.2.8 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 serialport@0.2.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!     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
EN

回答 3

Stack Overflow用户

发布于 2012-02-10 13:31:00

在此过程中,似乎软件包二进制文件(至少在10.10中)从node-waf更改为nodejs-waf。如果使用"node-waf“得到"Command not found”消息,请尝试使用"nodejs-waf“。

票数 1
EN

Stack Overflow用户

发布于 2011-07-13 06:24:37

我假设voodootikigod's serialport

代码语言:javascript
复制
alfred@alfred-laptop:~/node/contact$ npm install serialport

> serialport@0.2.8 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)
serialport@0.2.8 ../../node_modules/serialport 


alfred@alfred-laptop:~/node/contact$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"
alfred@alfred-laptop:~/node/contact$ node -v
v0.4.9
alfred@alfred-laptop:~/node/contact$ npm -v
1.0.15

如果它不能为你安装,那就太奇怪了。你应该输出完整的错误??

票数 0
EN

Stack Overflow用户

发布于 2013-01-16 01:14:28

在让serialport2与node.js 0.5一起工作时,我也遇到了类似的问题。

在升级到node.js 0.8+后使serialport2正常工作

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6671891

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档