monad.gon
monad.gon

Reputation: 967

I installed nodejs , but npm looks like not working( at embedded linux)

I installed Node.js.

  1. sudo apt-get install python-software-properties
  2. sudo add-apt-repository ppa:chris-lea/node.js
  3. sudo apt-get update
  4. sudo apt-get install nodejs (15.4MB)

I can find the Node.js npm.

root@linaro-server:/usr/bin# ll | grep node
lrwxrwxrwx  1 root   root         22 Jan 24 10:31 node -> /etc/alternatives/node*
-rwxr-xr-x  1 root   root    5996796 Jan 24 07:05 nodejs*
lrwxrwxrwx  1 root   root         38 Jan 24 07:05 npm -> ../lib/node_modules/npm/bin/npm-cli.js*

# node -v
v0.10.25
# npm -v
no returns, it looks like npm not working.

How can I activate npm or reinstall npm.

Now, I run this command:

curl https://npmjs.org/install.sh | sh

but my linux prompt stop at

fetching: http://registry.npmjs.org/npm/-/npm-1.3.25.tgz

How can I manage this probelem?

Upvotes: 0

Views: 1443

Answers (1)

monad.gon
monad.gon

Reputation: 967

I was confused the environment of nodejs.

My CPU is ARM.

uname -a

shows

Linux linaro-server 3.6.0-10612-g9d11689 #11 SMP PREEMPT Mon Dec 3 16:04:32 IST 2012 armv7l armv7l armv7l GNU/Linux

So I should compile node.js.

The following is my solution.

wget http://nodejs.org/dist/node-latest.tar.gz
tar zxvf node-latest.tar.gz
cd node-v*
./configure --without-snapshot --dest-cpu=arm --dest-os=linux
make
make install

the MAKE takes a time, but above steps show me the good result.

I can get normal return of node -v and npm -v.

root:/home/user01> node -v 
v0.11.9
root:/home/user01> npm -v
1.3.15

node and npm was installed at /usr/local/bin

root:/usr/local/bin> ll | grep node
-rwxr-xr-x  1 root root 10912375 Jan 27 08:04 node*
lrwxrwxrwx  1 root root       38 Jan 27 08:04 npm -> ../lib/node_modules/npm/bin/npm-cli.js*

I referred this file :

http://events.linuxfoundation.org/sites/events/files/slides/nodejs-presentation_0.pdf

Upvotes: 2

Related Questions