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

+1 vote

I am trying to install truffle on my Ubuntu system. I have used the following code to install truffle:

$ sudo npm install -g truffle

Now I am trying to run the truffle list command on the terminal but I get the following error on execution:

-bash: truffle: command not found

How can I solve this?

Jul 16, 2018 in Blockchain by digger
• 26,600 points
1,095 views

5 answers to this question.

+1 vote
Best answer

First try restarting the system and then execute this command.

If it does not work then try make a new npm project and keep the dependencies local. To do it, you run the following commands:

$ run npm init
$ run npm i truffle
$ run ./node_modules/.bin/truffle init

If both the above solutions do not work, then it should be some problem with the version. So, install the latest
version of npm and node. You can do it by running the following command:

$ npm install -g truffle
answered Jul 16, 2018 by slayer
• 29,240 points

selected May 5 by Omkar
+1 vote

Try installing truffle using the following commands:

$ npm install -g ethereumjs-testrpc
$ npm install -g truffle
answered May 5 by Firoz
+1 vote

Try installing truffle:

$ npm uninstall -g truffle
$ npm install -g truffle
answered May 5 by Jisha
0 votes

Try installing it like this using npx:

$ npx truffle@5.0.2 unbox pet-shop
answered May 5 by Umesh
0 votes

You can initiate truffle:

$ npm init truffle
answered May 5 by Hari

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 26,600 points
457 views
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,810 points
182 views
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,340 points
98 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,240 points
99 views