3

I have install: npm install -g truffle

Node version: v10.20.1

NPM version: 6.14.4 After installing npm install -g truffle, it gets install successfully, but when I checked

truffle version

it shows me ,command not found truffle

aksh
  • 31
  • 1
  • 3
  • What's your O/S? – trojanfoe Apr 16 '20 at 09:51
  • Mac OS catalina – aksh Apr 16 '20 at 10:13
  • Type `echo $PATH` and post the result – trojanfoe Apr 16 '20 at 10:32
  • akshay@Akshays-MacBook-Pro solc % truffle version zsh: command not found: truffle akshay@Akshays-MacBook-Pro solc % echo $path /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/go/bin /Library/Apple/usr/bin /Library/Frameworks/Mono.framework/Versions/Current/Commands akshay@Akshays-MacBook-Pro solc % – aksh Apr 17 '20 at 22:48

2 Answers2

1

Try running truffle version in the same console you did the npm install -g truffle If it works on that terminal but not in new ones it means that the npm is not configured to be persistent across your sessions.

Here is an example of how to enable npm in other sessions.

https://gist.github.com/rcugut/c7abd2a425bb65da3c61d8341cd4b02d#addappend-the-following-lines-in-bashrc

ccolorado
  • 181
  • 5
0

I had a similar issue. When I check the logs of npm install, I noticed these lines:

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

If you also have this kind of an error, that might be the reason.

I applied this:

sudo chown -R $USER /usr/local/lib/node_modules

and here is why: https://flaviocopes.com/npm-fix-missing-write-access-error/

After giving access to node_modules, I installed truffle again (this time it took much longer btw)

it worked for me, I hope it helps.

gezgingun
  • 462
  • 5
  • 11