Installing Nodejs: sh: node: command not found error

+1 vote

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: fsevents@1.1.3 (node_modules/ethereumjs-testrpc/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 install: `node install`
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! uglifyjs-webpack-plugin@0.4.6 postinstall: `node lib/post_install.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the uglifyjs-webpack-plugin@0.4.6 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Oct 22, 2018 in Blockchain by digger
• 27,620 points

4 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Best answer

You have to first install nodejs and npm:


sudo apt-get update
sudo apt-get install nodejs


sudo apt-get install npm
answered Oct 22, 2018 by Omkar
• 65,850 points

selected Apr 24 by Omkar
Hey! Worked for me, thanks
Not working. I installed the above mentioned without any error but still facing the same problem.

Hey @Firoz

Try adding the path as follows:

echo 'export PATH=$PATH:/usr/local/bin' >> $HOME/.bashrc
Hi @Omkar thanks for the reply. But when I install using apt-get, won't the path be set automatically?
When I tried installing using apt-get, it worked without exclusively setting the path. But because you could install it without any problem but still the error wasn't solved, I thought it could be a Path issue.
I think there was some problem with the path. Setting the path solved the problem. Thanks
Hello @Omkar. I installed the mentioned applications and also mentioned the right path. Still getting same error.

Hi @Likith. You might have to change the ownership, try this:

$ sudo chown -R $(whoami) ~/.npm
–1 vote

Try the following:

$ mean init
$ npm install
answered Apr 24 by Sam
0 votes

You could also try using nodejs-legacy. Try this:

$ sudo apt-get nodejs-legacy
answered Apr 24 by Giri
0 votes

I had to create a symbolic link to solve this error. Would work for you too

$ ln -s /usr/bin/nodejs /usr/bin/node
answered Apr 24 by Rishab

Related Questions In Blockchain

+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,040 points
0 votes
1 answer

Getting error when i execute ./ -m up command.

The error is caused because you're trying ...READ MORE

answered Jul 12, 2018 in Blockchain by slayer
• 29,040 points
0 votes
1 answer

Error during Hyperledger installation: Manifest peer latest not found

Change the tag from latest to x86_64-1.0.2 in the compose file. ...READ MORE

answered Jul 13, 2018 in Blockchain by Perry
• 16,450 points
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
0 votes
1 answer
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,320 points
0 votes
1 answer

Hyperledger Fabric peer command not found error.

This error occurs when the system can ...READ MORE

answered Jul 2, 2018 in Blockchain by Omkar
• 65,850 points
0 votes
1 answer

Hyperledger composer: runtime install error card not found peerAdmin

The right way to do it is: If ...READ MORE

answered Nov 5, 2018 in Blockchain by Omkar
• 65,850 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.