简体   繁体   中英

Can't execute global Node.js module from Bash shell script (Truffle)?

I installed Truffle, the Ethereum development toolkit, on my Ubuntu 14.04 PC. I can execute it easily from a terminal window by simply typing "truffle". However, when I try to execute Truffle from a Bash shell script, I get the following error:

ide-do-truffle.sh: line 3: truffle: command not found

The line inside the shell script is just:

truffle compile --network local

How can I execute Truffle from within a shell script?

If someone can also explain what goes on behind the scenes when you execute a globally installed Node.JS package like Truffle, that would be helpful too.

Its possible the PATH in your terminal window is not the same as the PATH that your shell script sees.

Try echo "$PATH" in both your terminal window and in your script just before your truffle line in your script, and compare the two. If there is a difference, then the problem is with the PATH in your shell script.

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