Path to Node.js Installation in Ubuntu
Solution 1
Quick explanation
You have a version with -pre
. Get rid of it and put the latest stable version from nodejs.org.
You can use which
to locate a command. For your case, type which nodejs
.
EDIT: The answer from your link is referring to the path of node source code, not the nodejs binary.
Solution 2
On Ubuntu, most software can be installed from the built-in repositories. This updates it for you (even if it's sometimes a bit outdated).
To install the stable version the Ubuntu way, install the nodejs-legacy
package (after uninstalling your version):
sudo apt install nodejs-legacy
To use the latest, refer to https://askubuntu.com/a/663052/438156 (my answer), or https://askubuntu.com/a/711976/438156 (bit more involved, more the Ubuntu way).
Related videos on Youtube
Mozak
A guy with an inclination for web technologies. Always trying to find out what when how and why of things.
Updated on July 09, 2022Comments
-
Mozak almost 2 years
I am new to Ubuntu (linux).
I installed node.js for a project.
Recently I am getting this error on
npm install
.Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
I found a stack link below as
Under the solution it asks for the directory where node.js is installed and currently i am clueless where the nodejs is installed.
Please help me on how can I locate the directory where node.js is installed.
-
c4pone almost 10 yearsWhich way did you used to install node.js ? Compile it from source or per package manager ? You can find the path of node with the terminal command locate, but it should be under /usr/bin/nodejs i think
-
jgillich almost 10 yearsWhat does
which nodejs
orwhich node
output? It seems like you installed node manually instead of usingapt-get
. -
Mozak almost 10 yearsI installed from here howtonode.org/how-to-install-nodejs
-
Mozak almost 10 yearsI installed it by cloning git clone git://github.com/ry/node.git cd node ./configure make sudo make install
-
-
Mozak almost 10 years/usr/bin/nodejs This is being printed on typing which nodejs
-
radubogdan almost 10 yearscan you tell me what version of node you installed? Probably you end up using a version with -pre behind. If you have the source from where you installed nodejs go and
sudo make uninstall
. Download the stable version from nodejs.org and install it. -
Mozak almost 10 yearsv0.11.14-pre, so I need to uninstall this and install a stable build?
-
radubogdan almost 10 yearsYup. I think is easier this way :) and should work with the stable version
-
techie_28 almost 7 years
which
is specific to Linux only?