Explore Courses Blog Tutorials Interview Questions
+3 votes
in Blockchain by (50.2k points)

The code I am running is as follows:

npm install -g ethereumjs-testrpc

/usr/local/bin/testrpc -> /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js

The error is as follows:

sh: node: command not found

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/ethereumjs-testrpc/node_modules/fsevents):

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install`


npm ERR! file sh


npm ERR! errno ENOENT

npm ERR! syscall spawn

npm ERR! [email protected] postinstall: `node lib/post_install.js`

npm ERR! spawn ENOENT

npm ERR! 

npm ERR! Failed at the [email protected] postinstall script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2 Answers

+4 votes
by (108k points)
edited by

The first step is to install nodejs and npm:

For Node.js: 

sudo apt-get update

sudo apt-get install nodejs

For npm:

sudo apt-get install npm

Give yourself time to explore the Blockchain field properly. Enroll in Blockchain Online Training now.

by (29.3k points)
After these commands, To check whether node js is installed or not you could use:

$ nodejs -v
by (19.7k points)
Worked for me readily! thanks
by (33.1k points)
It is the easiest way to install nodejs and npm.
by (47.2k points)
I think there was some problem with the path. Setting the path solved the issue. Thank you
by (19.9k points)
Thank you. It worked for me.
by (32.1k points)
I installed the mentioned applications and also mentioned the right path. Still getting the same error.
0 votes
by (106k points)

The command not found error you are getting because your PATH does not include the location of the node executable.

So you can use "/usr/local/bin/node" to run node.

Another thing you can add that location to your path by running the following command to add a single line to your bashrc file:

echo 'export PATH=$PATH:/usr/local/bin' >> $HOME/.bashrc

by (29.5k points)
Thanks worked like a charm!!
by (41.4k points)
If u install via nvm then node won' be there.
by (44.4k points)
The path was the problem, this solved the issue

Browse Categories