1

System - Raspbian (Jessie):

sudo apt-get install npm sudo npm install -g n sudo n stable

Now I have two instances of node.

/usr/bin/node -v returns v0.10.29

/usr/local/bin/node -v returns v6.2.1

Question:

sudo apt-get purge nodejs has a laundry list of packages that will be removed. Is it safe to purge these dependencies? Is the instance in /usr/local/bin self-contained or does it rely on these pre-existing packages? Will node red still work?

1

So I ran: sudo apt-get purge nodejs

Unfortunately, it did impact my ability to call node -v.

I was able to find where all the symbolic links using:

sudo find / -name "node" | less

Then I removed them and created a new one using:

sudo ln -s /usr/local/n/versions/node/6.2.2/bin/node /usr/local/bin/node

Now node -v returns v6.2.2 as expected.

EDIT:

Afterward, my Pi was having difficulty locating node pacakages I installed. I was able to remedy this by adding /usr/local/n/versions/node/6.2.2/bin to my $PATH environment variable.

To test if it will work for you (without making permanent changes), you can simply type. export PATH=$PATH:/usr/local/n/versions/node/6.2.2/bin

If that worked, then you can permanently update your path variable by editing /etc/profile; the file where the $PATH variable gets set. sudo nano /etc/profile

NOTE: You will need to replace 6.2.2 with your current version of node

0

I purged the original Node.js that comes pre-installed with the Pi and installed Node.js myself. The purge did indeed remove Node-RED and other Node based tools. After I installed the latest Node.js I then manually installed the packages I needed (such as Node-RED). I suffered no ill effects and ended up with exactly the set of installed packages at the correct levels that I wanted. My recommendation is to note the packages that are removed by a Node.js purge and decide which of them you want to have again.

I use Node.js extensively on the Pi and there has been no ill effects on me following this procedure.

  • Thanks for the quick response, it gave me the courage to pull the trigger! I recorded my experience as a more specific answer for others. – Zak Jun 17 '16 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.