+3 votes
1 view
in Blockchain by (28.1k 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 WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

npm ERR! file sh

npm ERR! code ELIFECYCLE

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 (57.5k points)

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

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

$ nodejs -v
by (24.8k points)
Worked for me readily! thanks
by (33.1k points)
It is the easiest way to install nodejs and npm.
Thanks!
by (41.2k points)
I think there was some problem with the path. Setting the path solved the issue. Thank you
by (11.2k points)
Thank you. It worked for me.
by (30.1k points)
I installed the mentioned applications and also mentioned the right path. Still getting the same error.
0 votes
by (107k 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 (27.7k points)
Thanks worked like a charm!!
by (32.3k points)
If u install via nvm then node won' be there.
by (42.5k points)
The path was the problem, this solved the issue
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...