简体   繁体   中英

truffle installation issue “-bash : truffle: command not found”

i am trying to set up the environment for developing dapps on my mac using https://medium.com/tomochain/how-to-build-a-dapp-on-tomochain-85532a1192e7 tutorial. upon installing truffle, i am unable to use truffle commands from project directories. i think there is some issue with setting up the path variable or truffle not being a global installation. Here is the output from the console

Sheikhs-MacBook-Air:~ Zubair$ node -v v10.15.1

Sheikhs-MacBook-Air:~ Zubair$ npm -v 6.4.1

Sheikhs-MacBook-Air:~ Zubair$ truffle version -bash: truffle: command not found

Sheikhs-MacBook-Air:~ Zubair$ ./node_modules/.bin/truffle version Truffle v5.0.3 (core: 5.0.3) Solidity v0.5.0 (solc-js) Node v10.15.1

Sheikhs-MacBook-Air:~ Zubair$ cd pet-shop-tutorial

Sheikhs-MacBook-Air:pet-shop-tutorial Zubair$ truffle version -bash: truffle: command not found

Sheikhs-MacBook-Air:pet-shop-tutorial Zubair$ ./node_modules/.bin/truffle version -bash: ./node_modules/.bin/truffle: No such file or directory

Sheikhs-MacBook-Air:pet-shop-tutorial Zubair$ npm config get prefix /Users/Zubair/pet-shop-tutorial/~.npm-global

Turns out it was an issue with the environment path variable. needed to append "/Users/Zubair/~.npm-global/bin/" to the path variable to make truffle accessible from working directories. This answer helped me resolve the issue. https://ethereum.stackexchange.com/questions/52812/error-in-installing-truffle-in-macos

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM