Abhishek Deora
Abhishek Deora

Reputation: 86

apt- get command error while installing nodejs

i tried to install nodejs using apt-get install but i am getting the following errors

Setting up spamassassin (3.4.0-6) ... error: gpg required but not found! It is not recommended, but you can use "sa-update" with the --no-gpg to skip the verification. dpkg: error processing package spamassassin (--configure): subprocess installed post-installation script returned error exit status 2 dpkg: dependency problems prevent configuration of sa-compile: sa-compile depends on spamassassin (>= 3.3.2-8); however: Package spamassassin is not configured yet.

dpkg: error processing package sa-compile (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: spamassassin sa-compile E: Sub-process /usr/bin/dpkg returned an error code (1)

after this it terminates . How to resolve it ?

Upvotes: 0

Views: 1807

Answers (1)

Brian
Brian

Reputation: 3334

So, I used apt-get the first couple times I built systems I was doing development on to install node.js, but I quickly moved away from it. It is nice and clean to be able to just use a one line command, but the apt repositories aren't updated very often and you are then linked into their chosen version, not the one you want or have tested against.

I moved to using the precompiled node.js executable (using node 0.8.21 on Ubuntu 12.04). To do this, I run the following commands from a shell script or command line with sudo once I download the file from Joyent at http://nodejs.org/dist/v0.8.21/node-v0.8.21-linux-x64.tar.gz to /home/username/Desktop/node-v08.21-linux-x64.tar.gz:

# untar the tar file to the directory /usr/local
tar -xvf /home/username/Desktop/node-v0.8.21-linux-x64.tar.gz -C /usr/local

# now create symbolic link in the /usr/local directory
ln -s /usr/local/node-v0.8.21-linux-x64/bin/node /usr/local/bin/node
ln -s /usr/local/node-v0.8.21-linux-x64/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

#now make the directory to hold the node modules npm and set permissions
mkdir -p /usr/local/lib/node_modules
chmod 755 /usr/local/lib/node_modules

If you are on a system where you need to compile from scratch, you can download the source from http://nodejs.org/dist/v0.8.21/node-v0.8.21.tar.gz at Joyent and run the following commands from a terminal or a script run with sudo to compile and deploy node:

#install things we need to install node
DEBIAN_FRONTEND=noninteractive apt-get install -y  build-essential python libssl-dev

#create and move into directory to do the install from
cd /home/username
mkdir nodeInstallDirectory
cd nodeInstallDirectory

#copy the tarred install file out for node
cp /home/username/Desktop/node-v0.8.21.tar.gz /home/username/nodeInstallDirectory/node-v0.8.21.tar.gz

#untar, and move into directory for node code
tar -xvf node-v0.8.21.tar.gz
cd node-v0.8.21

#these next three lines do the install itself
./configure
make -j 5
make install

These instructions should work pretty well for later or earlier Node.js versions as well.

Upvotes: 1

Related Questions