matter-labs / zkcli-block-explorer

zkSync Block Explorer module for zkcli
MIT License
7 stars 7 forks source link

BE fails to spin up using zksync-cli dev start due to permissions #16

Open dutterbutter opened 1 month ago

dutterbutter commented 1 month ago

πŸ› Bug Report for Block Explorer zkcli module

πŸ“ Description

When using zksync-cli to spin up a local block explorer it frequently errors due to permissions.

Provide a clear and concise description of the bug.

πŸ”„ Reproduction Steps

Steps to Reproduce

  1. Install zkSync CLI using Bunx

    Run the following command to install or update the zkSync CLI:

    bunx zksync-cli@latest dev config
  2. Select Node Type and Enable Block Explorer

    Follow the on-screen prompts to configure your environment:

    • Choose your preferred node type (e.g., Dockerized setup).
    • Ensure that you select Block Explorer as part of the setup.
  3. Start the zkSync Development Environment

    Once configuration is complete, run the following command to start the environment:

    bunx zksync-cli@latest dev start
  4. Observe the Error

    When starting the environment, you will encounter the following error related to file permissions during the installation of Block Explorer:

    Installing "Block Explorer"...
    β“˜ There was an error while starting the testing environment:
    β“˜ EACCES: permission denied, copyfile '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml' -> '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml'
    node:fs:2969
      handleErrorFromBinding(ctx);
      ^
    
    Error: EACCES: permission denied, copyfile '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml' -> '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml'
        at Object.copyFileSync (node:fs:2969:3)
        at SetupModule.install (file:///private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/dist/index.js:96:16)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async installModules (file:///private/tmp/bunx-501-zksync-cli@latest/node_modules/zksync-cli/bin/commands/dev/start.js:17:9)
        at async Command.handler (file:///private/tmp/bunx-501-zksync-cli@latest/node_modules/zksync-cli/bin/commands/dev/start.js:149:9) {
      errno: -13,
      syscall: 'copyfile',
      code: 'EACCES',
      path: '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml',
      dest: '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml',
      level: 'error',
      [Symbol(message)]: "\\x1B[91mβ“˜ EACCES: permission denied, copyfile '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml' -> '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml'\\x1B[39m"
    }
    
    Node.js v18.17.0
    

πŸ€” Expected Behavior

For the block explorer to start up with no issues.

😯 Current Behavior

Errors with permissions issue:

    Installing "Block Explorer"...
    β“˜ There was an error while starting the testing environment:
    β“˜ EACCES: permission denied, copyfile '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml' -> '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml'
    node:fs:2969
      handleErrorFromBinding(ctx);
      ^

    Error: EACCES: permission denied, copyfile '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml' -> '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml'
        at Object.copyFileSync (node:fs:2969:3)
        at SetupModule.install (file:///private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/dist/index.js:96:16)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async installModules (file:///private/tmp/bunx-501-zksync-cli@latest/node_modules/zksync-cli/bin/commands/dev/start.js:17:9)
        at async Command.handler (file:///private/tmp/bunx-501-zksync-cli@latest/node_modules/zksync-cli/bin/commands/dev/start.js:149:9) {
      errno: -13,
      syscall: 'copyfile',
      code: 'EACCES',
      path: '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml',
      dest: '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml',
      level: 'error',
      [Symbol(level)]: 'error',
      [Symbol(message)]: "\\x1B[91mβ“˜ EACCES: permission denied, copyfile '/private/tmp/bunx-501-zksync-cli@latest/node_modules/zkcli-block-explorer/docker-compose.yml' -> '/Users/dustinbrickwood/.local/state/zksync-cli/modules/zkcli-block-explorer/docker-compose.yml'\\x1B[39m"
    }

    Node.js v18.17.0

πŸ–₯️ Environment

πŸ“‹ Additional Context

πŸ“Ž Log Output

Paste any relevant log output here.
dutterbutter commented 1 month ago

Had to adjust permissions locally by running sudo chown -R $(whoami) on the issued path.