matter-labs / zksync-cli

CLI tool that simplifies ZKsync development
MIT License
166 stars 96 forks source link

`zksync-cli dev start` command failed to build the Docker image due to a bug in the `zkcli-in-memory-node` Dockerfile #130

Open 0x-stan opened 7 months ago

0x-stan commented 7 months ago

🐛 Bug Report for zkSync CLI

📝 Description

zksync-cli dev start command failed to build the docker image due to a bug in the zkcli-in-memory-node Dockerfile. I have submitted a PR to the zkcli-in-memory-node repo to fix this issue.

https://github.com/matter-labs/zkcli-in-memory-node/pull/3

Using curl -s echo may cause the jq -r command to fail, but removing the echo command allows it to execute correctly. The current version of the Dockerfile will cause the build to fail; after modification, it can be built successfully.

# query faild with echo
curl -s echo "https://api.github.com/repos/matter-labs/era-test-node/releases/tags/v0.1.0-alpha.19" | jq -r
jq: parse error: Invalid numeric literal at line 1, column 10

# query successfully without echo
curl -s "https://api.github.com/repos/matter-labs/era-test-node/releases/tags/v0.1.0-alpha.19" | jq -r
{
  "url": "https://api.github.com/repos/matter-labs/era-test-node/releases/147603455",
  "assets_url": "https://api.github.com/repos/matter-labs/era-test-node/releases/147603455/assets",
  "upload_url": "https://uploads.github.com/repos/matter-labs/era-test-node/releases/147603455/assets{?name,label}",
  ...
}

🔄 Reproduction Steps

  1. npx zksync-cli dev start

🤔 Expected Behavior

npx zksync-cli dev start command execute successfully.

😯 Current Behavior

npx zksync-cli dev start command execute faild.

🖥️ Environment

📋 Additional Context

📎 Log Output

image
> npx zksync-cli dev start

Installing "In memory node"...
[+] Building 3.5s (10/11)                                                                                                                       
 => [zksync internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 787B                                                                                                       0.0s
 => [zksync internal] load .dockerignore                                                                                                   0.0s
 => => transferring context: 2B                                                                                                            0.0s
 => [zksync internal] load metadata for docker.io/library/ubuntu:latest                                                                    3.2s
 => [zksync auth] library/ubuntu:pull token for registry-1.docker.io                                                                       0.0s
 => [zksync 1/7] FROM docker.io/library/ubuntu:latest@sha256:77906da86b60585ce12215807090eb327e7386c8fafb5402369e421f44eff17e              0.0s
 => CACHED [zksync 2/7] WORKDIR /app                                                                                                       0.0s
 => CACHED [zksync 3/7] RUN apt-get update   && apt-get install -y curl jq   && apt-get clean   && rm -rf /var/lib/apt/lists/*             0.0s
 => CACHED [zksync 4/7] RUN echo "In memory node version: v0.1.0-alpha.19"                                                                 0.0s
 => CACHED [zksync 5/7] RUN curl -s echo "https://api.github.com/repos/matter-labs/era-test-node/releases/tags/v0.1.0-alpha.19" |   jq -r  0.0s
 => ERROR [zksync 6/7] RUN tar xz -f era_test_node.tar.gz -C /usr/local/bin/                                                               0.2s
------
 > [zksync 6/7] RUN tar xz -f era_test_node.tar.gz -C /usr/local/bin/:
#0 0.208 tar (child): era_test_node.tar.gz: Cannot open: No such file or directory
#0 0.208 tar (child): Error is not recoverable: exiting now
#0 0.210 tar: Child returned status 2
#0 0.211 tar: Error is not recoverable: exiting now
------
failed to solve: process "/bin/sh -c tar xz -f era_test_node.tar.gz -C /usr/local/bin/" did not complete successfully: exit code: 2
ⓘ There was an error while starting the testing environment:
ⓘ Command exited with code 17: 
file:///Users/stan/.npm/_npx/ed2d5270b29717fa/node_modules/zksync-cli/bin/utils/helpers.js:52
                reject(new Error(`Command exited with code ${code}: ${errorOutput}`));
                       ^

Error: Command exited with code 17: 
    at ChildProcess.<anonymous> (file:///Users/stan/.npm/_npx/ed2d5270b29717fa/node_modules/zksync-cli/bin/utils/helpers.js:52:24)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  level: 'error',
  [Symbol(level)]: 'error',
  [Symbol(message)]: '\x1B[91mⓘ Command exited with code 17: \x1B[39m'
}

Node.js v20.11.0
PatrickAlphaC commented 1 month ago

I am also getting this error, except mine is a little different.

Screenshot 2024-09-04 at 2 01 26 PM
12.89 Updating certificates in /etc/ssl/certs...
14.78 Illegal instruction
14.82 dpkg: error processing package ca-certificates (--configure):
14.82  installed ca-certificates package post-installation script subprocess returned error exit status 132
14.82 Setting up libgssapi-krb5-2:amd64 (1.20.1-6ubuntu2.1) ...
14.84 Setting up libssh-4:amd64 (0.10.6-2build2) ...
14.84 Setting up jq (1.7.1-3build1) ...
14.84 Setting up libcurl4t64:amd64 (8.5.0-2ubuntu10.3) ...
14.84 Setting up curl (8.5.0-2ubuntu10.3) ...
14.85 Processing triggers for libc-bin (2.39-0ubuntu8.2) ...
14.88 Errors were encountered while processing:
14.88  ca-certificates
14.91 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
failed to solve: process "/bin/sh -c apt-get update   && apt-get install -y curl jq   && apt-get clean   && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
ⓘ There was an error while starting the testing environment:
ⓘ Command exited with code 17: 
file:///PATH/node_modules/zksync-cli/bin/utils/helpers.js:52
                reject(new Error(`Command exited with code ${code}: ${errorOutput}`));
                       ^

Error: Command exited with code 17: 
    at ChildProcess.<anonymous> (file:///PATH/node_modules/zksync-cli/bin/utils/helpers.js:52:24)
    at ChildProcess.emit (node:events:520:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  level: 'error',
  [Symbol(level)]: 'error',
  [Symbol(message)]: '\x1B[91mⓘ Command exited with code 17: \x1B[39m'
}

Node.js v22.7.0