nodejs version issue when installing express

2019-09-01 15:50发布

Just setting up my raspberry pi as node.js server. Did a clean install of Raspberian

then installed node

if I do node -v it says: v0.10.25

then installed npm

if I do npm --version it says: 1.1.4

if I do then npm install express it fails and as the reason why it says

npm ERR! Required: {"node":">= 0.8.0"} npm ERR! Actual: {"npm":"1.1.4","node":"0.6.19"}

Any idea what I am doing wrong?

2条回答
The star\"
2楼-- · 2019-09-01 16:16

Looks like a bad intall of nodejs.

Try to:

Remove nodejs:

sudo apt-get purge nodejs

then, get the python-s-p package:

sudo apt-get update

sudo apt-get install python-software-properties

Add add the chris-lea ppa:

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get update

Finally, install again

sudo apt-get install nodejs  

Everything should work fine now.

查看更多
The star\"
3楼-- · 2019-09-01 16:37
登录 后发表回答