Node.js npm未能安装节点hid(未能安装最新版本的Nodejs)

Node.js npm未能安装节点hid(未能安装最新版本的Nodejs),node.js,npm,raspberry-pi,Node.js,Npm,Raspberry Pi,我正在尝试在我的Raspberry Pi Raspbian上安装节点hid。 但是node hid需要一个高版本的Nodejs才能工作>=0.8,而我的版本只有0.6.19 所以,我尝试用nvm安装Nodejs v0.10.26。。。Nvm已成功安装nodejs v0.10.26,但npm仍使用旧版本的nodejs。如何在整个系统中使用Nodejs的v0.10.26版本?如何安装节点hid 谢谢你的帮助 以下是我在尝试安装节点hid时得到的代码: pi@raspberrypi ~ $ sudo

我正在尝试在我的Raspberry Pi Raspbian上安装节点hid。 但是node hid需要一个高版本的Nodejs才能工作>=0.8,而我的版本只有0.6.19

所以,我尝试用nvm安装Nodejs v0.10.26。。。Nvm已成功安装nodejs v0.10.26,但npm仍使用旧版本的nodejs。如何在整个系统中使用Nodejs的v0.10.26版本?如何安装节点hid

谢谢你的帮助

以下是我在尝试安装节点hid时得到的代码:

pi@raspberrypi ~ $ sudo npm install -g node-hid
npm http GET https://registry.npmjs.org/node-hid

npm ERR! Error: failed to fetch from registry: node-hid
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:209:10)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at ClientRequest.onError (/usr/lib/nodejs/request/tunnel.js:164:21)
npm ERR!     at ClientRequest.g (events.js:156:14)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/pi/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.6.11+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "node-hid"
npm ERR! cwd /home/pi
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: node-hid
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/npm-debug.log
npm not ok
在npm-debug.log中:

info it worked if it ends with ok
verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'install', 'node-hid', '-g' ]
info using npm@1.1.4
info using node@v0.6.19
verbose config file /root/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
silly exec /usr/bin/nodejs "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 1000
silly spawning [ '/usr/bin/nodejs',
silly spawning   [ '/usr/share/npm/bin/npm-get-uid-gid.js', 'nobody', 1000 ],
silly spawning   null ]
silly output from getuid/gid {"uid":65534,"gid":1000}
silly output from getuid/gid 
verbose cache add [ 'node-hid', null ]
silly cache add: name, spec, args [ undefined, 'node-hid', [ 'node-hid', null ] ]
verbose parsed url { pathname: 'node-hid', path: 'node-hid', href: 'node-hid' }
verbose addNamed [ 'node-hid', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'node-hid', '', false ]
verbose raw, before any munging node-hid
verbose url resolving [ 'https://registry.npmjs.org/', './node-hid' ]
verbose url resolved https://registry.npmjs.org/node-hid
http GET https://registry.npmjs.org/node-hid
ERR! Error: failed to fetch from registry: node-hid
ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
ERR!     at Request.emit (events.js:88:20)
ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:209:10)
ERR!     at ClientRequest.emit (events.js:67:17)
ERR!     at ClientRequest.onError (/usr/lib/nodejs/request/tunnel.js:164:21)
ERR!     at ClientRequest.g (events.js:156:14)
ERR! You may report this log at:
ERR!     <http://bugs.debian.org/npm>
ERR! or use
ERR!     reportbug --attach /home/pi/npm-debug.log npm
ERR! 
ERR! System Linux 3.10.25+
ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-hid" "-g"
ERR! cwd /home/pi
ERR! node -v v0.6.19
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: node-hid
verbose exit [ 1, true ]
以下几点对我很有用: 检查您的系统是否是最新的: 安装节点的最新版本 检查是否安装了节点的最新版本 为节点hid安装依赖项 不完全确定是否全部需要一些可能已经安装,但这是唯一对我有效的东西

sudo apt-get install g++ curl
sudo apt-get install libssl-dev apache2-utils
sudo apt-get install build-essential
sudo apt-get install pkg-config

sudo npm install node-gyp -g

sudo apt-get install git-core
sudo apt-get install libudev-dev
sudo apt-get install libusb-1.0-0-dev
安装节点hid 注意:上面的节点安装仅适用于Raspbian,如果您想在Ubuntu中进行实验,请使用以下代码安装节点,其他所有内容保持不变:

sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs 
以下几点对我很有用: 检查您的系统是否是最新的: 安装节点的最新版本 检查是否安装了节点的最新版本 为节点hid安装依赖项 不完全确定是否全部需要一些可能已经安装,但这是唯一对我有效的东西

sudo apt-get install g++ curl
sudo apt-get install libssl-dev apache2-utils
sudo apt-get install build-essential
sudo apt-get install pkg-config

sudo npm install node-gyp -g

sudo apt-get install git-core
sudo apt-get install libudev-dev
sudo apt-get install libusb-1.0-0-dev
安装节点hid 注意:上面的节点安装仅适用于Raspbian,如果您想在Ubuntu中进行实验,请使用以下代码安装节点,其他所有内容保持不变:

sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs 

/home/pi/npm-debug.log中有什么?您连接到internet了吗?您在多次尝试后是否收到相同的错误?是的,我已连接到internet。。我试了很多次,但还是不起作用!/home/pi/npm-debug.log中有什么?您连接到internet了吗?您在多次尝试后是否收到相同的错误?是的,我已连接到internet。。我试了很多次,但还是不起作用!
npm install node-hid
sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs