I want to find where is my node.js in ubuntu linux system, the command: which node gives me the path of /usr/bin/node, but when I go to that folder, there i
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 use node app.js
to execute your app instead of nodejs app.js
.
You can downgrade node to a desired version, e.g: sudo n 0.12.4
check your version to verify: node --version
If you have both Nodejs and npm installed correctly, just open your terminal:
Run: npm config ls -l
to see a set of configuration parameters that are internal to npm.
npm is configured from the following sources, sorted by priority:
--save-dev, --prefix, --global
npm_config_foo=bar
or NPM_CONFIG_FOO=bar
--allow-same-version
would be npm_config_allow_same_version=true
/path/to/my/project/.npmrc
$HOME/.npmrc
; also configurable via CLI option --userconfig
or environment variable $NPM_CONFIG_USERCONFIG
) $PREFIX/etc/npmrc
; also configurable via CLI option --globalconfig
or environment variable $NPM_CONFIG_GLOBALCONFIG
) /path/to/npm/npmrc
) For those who may be unfamiliar or new to Nodejs, npm and nvm the user needs to be aware that it's possible to have more then one version of Node on your system.
It's also possible to have Node stored both locally and globally.
With multiple versions and different locations it's possible that $ which node
may not give you the right location and if you run $ locate node
your gonna end up with too many locations to sort through.
Using the built-in Node/npm tools to locate Node seems to make the most sense.
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 :)
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
.