alias of nodejs as node on 14.04
Solution 1
Recently fixed this using nodejs-legacy
.
Run the following command:
sudo apt-get install nodejs-legacy
This should fix it.
Solution 2
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.
Related videos on Youtube
gbenga wale
Updated on September 18, 2022Comments
-
gbenga wale over 1 year
I have a form which is used to insert records into the database and if all goes right redirect the user to the index page with a message (actually set with a session) about the success or failure of the operation.
Now, am able to set the session in add_book.php and display the message in index.php but the message still persist after reloading the page without going away.
in add_book.php. I have this
$_SESSION['insert'] = "Record inserted into the database"; session_regenerate_id(); session_write_close(); echo '...succesfully add new book...'; header("Location: index.php"); exit();
and in the index.php, I have this
<?php if(isset($_SESSION['insert'])){ ?> <p class="update"><?php echo $_SESSION['insert'];?></p> <?php }//end of isset $_SESSION['insert'] ?>
-
PradyJord almost 10 yearsPlease add the same alias in
/etc/profile
andrestart
; after changing anyrc
file or profile file you must source it. -
codeofnode almost 10 years@Jord i edited /etc/profile with same alias and restarted. But still the problem is same.
-
John N over 7 yearsSeveral years late, but... aliases won't (normally) work in a non-interactive shell: stackoverflow.com/a/1615973/7222080 Follow the symlink advice in the answers.
-
Roy Bogado over 6 yearssession_start() maybe?
-
The Codesee over 6 yearsHave you tried unsetting the session?
-
Patrick Q over 6 yearsWell, what exactly are you doing to remove the message from the session? It doesn't just go away by itself.
-
gbenga wale over 6 yearssession is started already
-
Rotimi over 6 yearsare you using
unset()
to remove the session? or perhaps setting it tonull
? -
gbenga wale over 6 years@patrick I think isset should do the job after it is redirect but after reloading, it should disappear since nothing is set again
-
Patrick Q over 6 yearsOnce something is set in a session, it stays until removed or the session is destroyed. It doesn't just go away because you loaded a new page.
-
gbenga wale over 6 years@tunde no. didnt do that
-
Rotimi over 6 yearsdoesn't @Manikiran solution solve your issue?
-
gbenga wale over 6 years@patrick then the unsetting will be inside else statement
-
Patrick Q over 6 yearsYou should really go back and review the basics of sessions and if/else logic. You are severely misunderstanding how all this stuff works.
-
Rotimi over 6 yearsyou do not need an else statement. Once the insert key exists in the session, echo it then on the next line
unset()
it. Simple
-
-
srcspider about 9 yearsFind the location of nodejs via
whereis nodejs
then doln -s /usr/bin/nodejs ~/bin/node
(yes, nosudo
there); replace/usr/bin/nodejs
with the path your nodejs is at -
srcspider about 9 yearsgoing backwards is not the way forward