Truffle command not found after installation

user3480478 picture user3480478 · Jul 1, 2016 · Viewed 10.4k times · Source

I installed truffle through npm with the following:

sudo npm install -g truffle

but when I run truffle list on the console it just gives me

bash: truffle: command not found

Answer

drussell picture drussell · Oct 23, 2017

I had a similar problem. I ran npm i -g truffle and then when I tried to run truffle init I got an error: zsh: command not found: truffle. What solved it for me is to create a local node_modules with truffle installed in it, and then run that copy.

  1. run npm init and make a new npm project
  2. run npm i truffle
  3. run ./node_modules/.bin/truffle init and it should work!