turbo icon indicating copy to clipboard operation
turbo copied to clipboard

with-docker build failure yarn install

Open kylehassett opened this issue 3 years ago • 6 comments

What version of Turborepo are you using?

latest as of Oct 23rd 10:09 pm est

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac (M1 max)

Describe the Bug

  • Trying to use turborepo to deploy to google cloud run
  • Using turborepo/examples/with-docker as starting point
  • cd to with-docker root
  • Run the following build command: docker build --progress=plain -t test-turbo-cloud-run-api -f apps/api/Dockerfile .
    • Same failure occurs when following the steps in with-dockers README to the letter.
  • Docker build fails at RUN yarn install with this error...
#21 19.79 [5/5] Building fresh packages...
#21 20.29 error /app/node_modules/turbo: Command failed.
#21 20.29 Exit code: 1
#21 20.29 Command: node install.js
#21 20.29 Arguments:
#21 20.29 Directory: /app/node_modules/turbo
#21 20.29 Output:
#21 20.29 node:internal/errors:863
#21 20.29   const err = new Error(message);
#21 20.29               ^
#21 20.29
#21 20.29 Error: Command failed: node /app/node_modules/turbo/bin/turbo --version
#21 20.29 /app/node_modules/turbo/bin/turbo:13
#21 20.29     throw e;
#21 20.29     ^
#21 20.29
#21 20.29 <ref *1> Error: spawnSync /app/node_modules/turbo-linux-arm64/bin/turbo ENOENT
#21 20.29     at Object.spawnSync (node:internal/child_process:1117:20)
#21 20.29     at spawnSync (node:child_process:857:24)
#21 20.29     at Object.execFileSync (node:child_process:900:15)
#21 20.29     at Object.<anonymous> (/app/node_modules/turbo/bin/turbo:6:28)
#21 20.29     at Module._compile (node:internal/modules/cjs/loader:1159:14)
#21 20.29     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
#21 20.29     at Module.load (node:internal/modules/cjs/loader:1037:32)
#21 20.29     at Module._load (node:internal/modules/cjs/loader:878:12)
#21 20.29     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
#21 20.29     at node:internal/main/run_main_module:23:47 {
#21 20.29   errno: -2,
#21 20.29   code: 'ENOENT',
#21 20.29   syscall: 'spawnSync /app/node_modules/turbo-linux-arm64/bin/turbo',
#21 20.29   path: '/app/node_modules/turbo-linux-arm64/bin/turbo',
#21 20.29   spawnargs: [ '--version' ],
#21 20.29   error: [Circular *1],
#21 20.29   status: null,
#21 20.29   signal: null,
#21 20.29   output: null,
#21 20.29   pid: 67,
#21 20.29   stdout: null,
#21 20.29   stderr: null
#21 20.29 }
#21 20.29
#21 20.29 Node.js v19.0.0
#21 20.29
#21 20.29     at checkExecSyncError (node:child_process:871:11)
#21 20.29     at Object.execFileSync (node:child_process:907:15)
#21 20.29     at validateBinaryVersion (/app/node_modules/turbo/install.js:25:6)
#21 20.29     at /app/node_modules/turbo/install.js:305:5 {
#21 20.29   status: 1,
#21 20.29   signal: null,
#21 20.29   output: [
#21 20.29     null,
#21 20.29     Buffer(0) [Uint8Array] [],
#21 20.29     Buffer(1089) [Uint8Array] [
#21 20.29        47,  97, 112, 112,  47, 110, 111, 100, 101,  95, 109, 111,
#21 20.29       100, 117, 108, 101, 115,  47, 116, 117, 114,  98, 111,  47,
#21 20.29        98, 105, 110,  47, 116, 117, 114,  98, 111,  58,  49,  51,
#21 20.29        10,  32,  32,  32,  32, 116, 104, 114, 111, 119,  32, 101,
#21 20.29        59,  10,  32,  32,  32,  32,  94,  10,  10,  60, 114, 101,
#21 20.29       102,  32,  42,  49,  62,  32,  69, 114, 114, 111, 114,  58,
#21 20.29        32, 115, 112,  97, 119, 110,  83, 121, 110,  99,  32,  47,
#21 20.29        97, 112, 112,  47, 110, 111, 100, 101,  95, 109, 111, 100,
#21 20.29       117, 108, 101, 115,
#21 20.29       ... 989 more items
#21 20.29     ]
#21 20.29   ],
#21 20.29   pid: 49,
#21 20.29   stdout: Buffer(0) [Uint8Array] [],
#21 20.29   stderr: Buffer(1089) [Uint8Array] [
#21 20.29      47,  97, 112, 112,  47, 110, 111, 100, 101,  95, 109, 111,
#21 20.29     100, 117, 108, 101, 115,  47, 116, 117, 114,  98, 111,  47,
#21 20.29      98, 105, 110,  47, 116, 117, 114,  98, 111,  58,  49,  51,
#21 20.29      10,  32,  32,  32,  32, 116, 104, 114, 111, 119,  32, 101,
#21 20.29      59,  10,  32,  32,  32,  32,  94,  10,  10,  60, 114, 101,
#21 20.29     102,  32,  42,  49,  62,  32,  69, 114, 114, 111, 114,  58,
#21 20.29      32, 115, 112,  97, 119, 110,  83, 121, 110,  99,  32,  47,
#21 20.29      97, 112, 112,  47, 110, 111, 100, 101,  95, 109, 111, 100,
#21 20.29     117, 108, 101, 115,
#21 20.29     ... 989 more items
#21 20.29   ]
#21 20.29 }
#21 20.29
#21 20.29 Node.js v19.0.0
#21 20.29 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
#21 ERROR: executor failed running [/bin/sh -c yarn install]: exit code: 1
------
 > [installer  7/10] RUN yarn install:
------
executor failed running [/bin/sh -c yarn install]: exit code: 1

Expected Behavior

Docker container builds successfully, I can deploy to docker hub, then deploy to google cloud run.

To Reproduce

See the description, it contains repro steps.

kylehassett avatar Oct 24 '22 02:10 kylehassett

Take a look at this comment, and my comment afterward. https://github.com/vercel/turborepo/issues/2293#issuecomment-1288148253

It seems that the fix was applied incorrectly to the with-docker example (the installer stage doesn't have this fix but the builder step does). If this isn't fixed by the end of the day I'll make a PR for it.

rafaeltab avatar Oct 24 '22 08:10 rafaeltab

@rafaeltab Should we wait for the fix or we should use your approach?

rmlevangelio avatar Oct 24 '22 10:10 rmlevangelio

@rmlevangelio You should be able to add RUN apk add --no-cache libc6-compat

weyert avatar Oct 24 '22 10:10 weyert

They will be almost the same, if you do it yourself just call the command at the installer stage. If you're unsure if you will be able to, you can always wait.

rafaeltab avatar Oct 24 '22 10:10 rafaeltab

Alright thanks @weyert and @rafaeltab 👍

rmlevangelio avatar Oct 24 '22 10:10 rmlevangelio

Added RUN apk add --no-cache libc6-compat for installer and it worked!

Thanks for the quick response to this.

kylehassett avatar Oct 25 '22 00:10 kylehassett