yuichiroaoki / poly-flashloan-bot

Flashloan Bot on Polygon
https://yuichiroaoki.medium.com/flashloan-bot-on-polygon-part-2-3eae0ac33986?sk=80821da4ca1d0462c7c9ae617df56bdd
MIT License
302 stars 192 forks source link

Docker giving error, and yarn hanging infinitely. #79

Closed Sshimaninja closed 2 years ago

Sshimaninja commented 2 years ago

When use the command source startup.sh I get the following error

[+] Building 2.3s (10/12)
 => [internal] load build definition from Dockerfile                                                                                                                                                                                    0.1s
 => => transferring dockerfile: 38B                                                                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                       0.1s
 => => transferring context: 35B                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/node:16.14                                                                                                                                                                           1.1s
 => [internal] load build context                                                                                                                                                                                                       0.4s
 => => transferring context: 3.72kB                                                                                                                                                                                                     0.4s
 => [1/8] FROM docker.io/library/node:16.14@sha256:6e54786b2ad01667d46524e82806298714f50d2be72b39706770aed55faedbd7                                                                                                                     0.0s
 => CACHED [2/8] WORKDIR /app                                                                                                                                                                                                           0.0s
 => CACHED [3/8] COPY package.json .                                                                                                                                                                                                    0.0s
 => CACHED [4/8] RUN yarn set version berry                                                                                                                                                                                             0.0s
 => CACHED [5/8] COPY .yarn tsconfig.json .yarnrc.yml ./                                                                                                                                                                                0.0s
 => ERROR [6/8] RUN yarn install                                                                                                                                                                                                        0.6s
------
 > [6/8] RUN yarn install:
#10 0.593 node:internal/modules/cjs/loader:936
#10 0.593   throw err;
#10 0.593   ^
#10 0.593
#10 0.593 Error: Cannot find module '/app/.yarn/releases/yarn-3.2.0.cjs'
#10 0.593     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
#10 0.593     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
#10 0.593     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
#10 0.593     at node:internal/main/run_main_module:17:47 {
#10 0.593   code: 'MODULE_NOT_FOUND',
#10 0.593   requireStack: []
#10 0.593 }
------
executor failed running [/bin/sh -c yarn install]: exit code: 1
TypeError: process.stdout.getWindowSize is not a function or its return value is not iterable
    at /app/dist/index.js:27:38
    at Generator.next (<anonymous>)
    at /app/dist/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/app/dist/index.js:4:12)
    at main (/app/dist/index.js:24:20)
    at Object.<anonymous> (/app/dist/index.js:173:18)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)

Using Ubuntu WSL2 and Yarn 3.2.0

Using yarn: Yarn install & build seem to work, but yarn start command hangs infinitely.

Sshimaninja commented 2 years ago

Attempting to update dependencies as requested by yarn install, this is my result: heliovortex@DESKTOP-ODVLU60:/mnt/d/code/arbitrage/yuichi/poly-flashloan-bot$ yarn install

➤ YN0000: ┌ Resolution step
➤ YN0061: │ @uniswap/v3-staker@npm:1.0.0 is deprecated: Please upgrade to 1.0.1
➤ YN0032: │ keccak@npm:3.0.2: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ secp256k1@npm:4.0.3: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ evp_bytestokey@npm:1.0.3: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ node-addon-api@npm:2.0.2: Implicit dependencies on node-gyp are discouraged
➤ YN0002: │ @uniswap/v3-periphery@npm:1.4.1 doesn't provide hardhat (pd1930), requested by hardhat-watcher
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 9s 179ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs-unparser@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:17.5.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yn@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 7s 115ms
➤ YN0000: ┌ Link step
➤ YN0001: │ Error: While cloning /mnt/d/code/arbitrage/yuichi/poly-flashloan-bot/node_modules/is-ci/node_modules/ci-info -> /mnt/d/code/arbitrage/yuichi/poly-flashloan-bot/node_modules/hardhat/node_modules/ci-info ENOENT: no such file or directory, scandir '/mnt/d/code/arbitrage/yuichi/poly-flashloan-bot/node_modules/is-ci/node_modules/ci-info'
➤ YN0000: └ Completed in 1m 25s
➤ YN0000: Failed with errors in 1m 41s

For some reason, "npm install hardhat" doesn't fix this and updating @uniswap/v3-staker doesn't either.

chinasilva commented 2 years ago

the same error

yuichiroaoki commented 2 years ago

That's probably because of yarn version issue. The repo's yarn version was 3.2.0, but the current stable version is 3.2.1. I have upgraded the version and added a docker build test on CI workflows.

Sshimaninja commented 2 years ago

Error outpout for source startup.sh is now:

[+] Building 66.3s (11/12)
[+] Building 78.6s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                    0.1s
 => => transferring dockerfile: 274B                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                       0.1s
 => => transferring context: 217B                                                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/node:16.14                                                                                                                                                                           0.0s
 => [1/8] FROM docker.io/library/node:16.14                                                                                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                       0.7s
 => => transferring context: 5.69MB                                                                                                                                                                                                     0.6s
 => CACHED [2/8] WORKDIR /app                                                                                                                                                                                                           0.0s
 => [3/8] COPY package.json .                                                                                                                                                                                                           0.1s
 => [4/8] RUN yarn set version berry                                                                                                                                                                                                    4.2s
 => [5/8] COPY .yarn tsconfig.json .yarnrc.yml ./                                                                                                                                                                                       0.2s
 => [6/8] RUN yarn install                                                                                                                                                                                                             56.2s
 => [7/8] COPY . ./                                                                                                                                                                                                                     0.2s
 => [8/8] RUN yarn build                                                                                                                                                                                                               15.0s
 => exporting to image                                                                                                                                                                                                                  1.9s
 => => exporting layers                                                                                                                                                                                                                 1.8s
 => => writing image sha256:<hash>                                                                                                                                           0.0s
 => => naming to docker.io/library/poly-flashloan-bot                                                                                                                                                                                   0.0s
/app/node_modules/streamroller/lib/RollingFileWriteStream.js:282
          throw e;
          ^

Error: EACCES: permission denied, mkdir 'log'
    at Object.mkdirSync (node:fs:1336:3)
    at mkdir (/app/node_modules/streamroller/lib/RollingFileWriteStream.js:270:19)
    at RollingFileStream._renewWriteStream (/app/node_modules/streamroller/lib/RollingFileWriteStream.js:299:5)
    at new RollingFileWriteStream (/app/node_modules/streamroller/lib/RollingFileWriteStream.js:94:10)
    at new RollingFileStream (/app/node_modules/streamroller/lib/RollingFileStream.js:18:5)
    at openTheStream (/app/node_modules/log4js/lib/appenders/file.js:52:20)
    at fileAppender (/app/node_modules/log4js/lib/appenders/file.js:68:16)
    at Object.configure (/app/node_modules/log4js/lib/appenders/file.js:126:10)
    at /app/node_modules/log4js/lib/appenders/index.js:92:27
    at Object.onlyOnMaster (/app/node_modules/log4js/lib/clustering.js:86:50) {
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: 'log'
}

I tried npm install -g --unsafe-perm=true --allow-root (even thought that's probably not wise) but the result is the same.

Kru0489 commented 2 years ago

@HankHoneymoon or @yuichiroaoki did you solve the issue for the "Error: EACCES: permission denied, mkdir 'log'" issue above? I've been going crazy trying to solve this with zero luck.

Sshimaninja commented 2 years ago

No sorry I just decided to write my own bot.