how can I find my node.js files in linux, /usr/bin/node is not working
running dpkg-query -L nodejs
will list the full path to every file belonging to the nodejs
package. If /usr/bin/node
is not there (it should be a symlink to /usr/bin/nodejs
), then something went wrong with the apt-get install
.
don't worry sudo apt-get install nodejs
installs a version of nodejs which is normally outdated. /usr/bin/nodejs
is therefore fine.
Do some additional work to use only node
for the command line:
install package manager npm:
sudo apt-get install npm
then upgrade npm:
sudo npm cache clear --force && sudo npm install -g npm
next install n:
sudo npm install -g n
which is a version manager for node.after this upgrade your node installation:
sudo n stable
this will create a/usr/bin/node
script which fixes your described issue so you can usenode app.js
to execute your app instead ofnodejs app.js
.
You can downgrade node to a desired version, e.g: sudo n 0.12.4
check your version to verify: node --version
In order to find the installation path, write the below command in the terminal:
which node
If it doesn't succeed, try this one:
which nodejs
Same thing for finding npm installation path:
which npm
If you are on Windows, write where
instead of which
Hope, it helps :)