Mozak Mozak - 10 months ago 63
Linux Question

Path where nodejs is installed in ubuntu

I am new to ubuntu (linux).

I installed nodejs 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

For this I searched and found a stack link below as

Node pre error

Under the solution it asks for the directory where nodejs is installed and currently i am clueless where the nodejs is installed.

Please help me on how can I locate the directory where nodejs is installed.

Answer Source

Quick explanation

You have a version with -pre. Get rid of it and put the latest stable version from

You can use which to locate a command. For your case, type which nodejs.

EDIT: The answer from your link is reffering to the path of node source code, not nodejs binary.