Truffle command not found after installation

2019-04-22 05:38发布

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

3条回答
男人必须洒脱
2楼-- · 2019-04-22 06:20

Please make sure you have the latest version of npm and node installed. I had the same issue, I updated npm and node to latest version and it worked.

npm install -g truffle works.

查看更多
Luminary・发光体
3楼-- · 2019-04-22 06:27

I did it on a Virtual box and had the same issue, but it worked after I restarted the computer. Hopefully that works for you too

查看更多
The star\"
4楼-- · 2019-04-22 06:32

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!
查看更多
登录 后发表回答