Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i installed nodejs with apt-get on 14.04

When i do nodejs -v

v0.10.25

and when i do node -v

node : command not found.

So i want to make alias of nodejs as node

So i inserted a line in ~/.bashrc

alias node=nodejs

Now i can access the nodejs with node on terminal.

But in my project, i use grunt which fires nodemon via gruntfile.js. Now nodemon tries to run node instead of nodejs

Now again i get the same problem node : command not found.

Means alias was not made for non-interactive shell non-login shell.

Where should i make the alias for this specific purpose and get my problem solved?

share|improve this question
    
Please add the same alias in /etc/profile and restart; after changing any rc file or profile file you must source it. –  PradyJord Jun 6 at 9:27
    
@Jord i edited /etc/profile with same alias and restarted. But still the problem is same. –  Koka Jun 6 at 9:51

1 Answer 1

Well curiously, I have a node. It's an alternatives system symlink and I'm not quite sure how I got it (in a way that you don't). It was a while since I installed it so perhaps I followed this SO post or one like it... Who knows!

You could just write a little bash alias but that'll only work for one user at a time. It might just make more sense to add it as as symlink globally. I'm not sure there's any value going through the alternatives system so we can just plonk one in /usr/local/bin (this is where non-package-managed binaries should go):

sudo ln -s /usr/local/bin/nodejs /usr/bin/node

Edit: That SO post I talked about actually links back to one of ours which might be relevant. It suggests installing nodejs-legacy is the way forward.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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