error at run ./ganache
Closed this issue · 2 comments
sudo: ./ganache: command not found
Then I change the ganache file to the ganache.sh and run:
./ganache.sh: 3: ./ganache.sh: /home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli: not found
Then I npm install -g ganache-cli into ../node_module/.bin/ganache-cli, it says:
`snack@ubuntu:~/eth-atomic-swap$ sudo ./ganache.sh Ganache CLI v6.0.3 (ganache-core: 2.0.2)
/home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli:74142
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!
Error: listen EADDRINUSE :::8545
at Object._errnoException (util.js:999:13)
at _exceptionWithHostPort (util.js:1020:20)
at Server.setupListenHandle [as _listen2] (net.js:1379:14)
at listenInCluster (net.js:1420:12)
at Server.listen (net.js:1508:7)
at Server.server.listen (/home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli:106029:17)
at Object. (/home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli:50243:8)
at webpack_require (/home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli:21:30)
at /home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli:64:18
at Object. (/home/snack/eth-atomic-swap/node_modules/.bin/ganache-cli:67:10)`
problem solved. I have other tasks occupied the port 8545.
If anyone else has this issue, ganache may already be running (so you can run truffle test
), or, if you are running another process using port 8545 (such as an ethereum node), you will have to run ganache on a different port.
To do so, edit truffle.js
and on line 5
change 8545
to 8546
. Run ganache-cli --port 8546
and then in a different terminal run truffle test
.