ckb-devrel / offckb

CKB local development network for your first try.
https://www.npmjs.com/package/@offckb/cli
MIT License
12 stars 3 forks source link

Error received when trying to use `offckb node`. #46

Closed jordanmack closed 7 months ago

jordanmack commented 8 months ago

The following error is received when trying to use the offckb node command.

This was observed on Ubuntu v20.04 LTS + Node v20.12.0 LTS via NVM v0.39.7.

username@ubuntu:~$ offckb node
/bin/sh: 1: /home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/target/ckb/ckb: not found
/home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/target/ckb/ckb not found, download and install the new version 0.113.1..
Error installing dependency binary: AxiosError: Request failed with status code 404
    at settle (/home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/node_modules/axios/dist/node/axios.cjs:1966:12)
    at Unzip.handleStreamEnd (/home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/node_modules/axios/dist/node/axios.cjs:3065:11)
    at Unzip.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
    at Axios.request (/home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/node_modules/axios/dist/node/axios.cjs:3876:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_BAD_REQUEST',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [ 'xhr', 'http' ],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function], Blob: [class Blob] },
    validateStatus: [Function: validateStatus],
    headers: Object [AxiosHeaders] {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': undefined,
      'User-Agent': 'axios/1.6.8',
      'Accept-Encoding': 'gzip, compress, deflate, br'
    },
    responseType: 'arraybuffer',
    method: 'get',
    url: 'https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip',
    data: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      connect: [Function (anonymous)],
      error: [Function (anonymous)],
      socket: [Function (anonymous)],
      timeout: [Function (anonymous)],
      finish: [Function: requestOnFinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: true,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    strictContentLength: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: true,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'github.com',
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _writableState: [WritableState],
      allowHalfOpen: false,
      _maxListeners: undefined,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      timeout: 5000,
      parser: null,
      _httpMessage: null,
      [Symbol(alpncallback)]: null,
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: -1,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 5000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 522,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 28,
        [Symbol(triggerId)]: 26
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: true,
      [Symbol(kSetKeepAliveInitialDelay)]: 1,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    _header: 'GET /nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'User-Agent: axios/1.6.8\r\n' +
      'Accept-Encoding: gzip, compress, deflate, br\r\n' +
      'Host: github.com\r\n' +
      'Connection: keep-alive\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype] {},
      freeSockets: [Object: null prototype],
      keepAliveMsecs: 1000,
      keepAlive: true,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'GET',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    joinDuplicateHeaders: undefined,
    path: '/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip',
    _ended: true,
    res: IncomingMessage {
      _events: [Object],
      _readableState: [ReadableState],
      _maxListeners: undefined,
      socket: null,
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      rawHeaders: [Array],
      rawTrailers: [],
      joinDuplicateHeaders: undefined,
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 404,
      statusMessage: 'Not Found',
      client: [TLSSocket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      _eventsCount: 4,
      responseUrl: 'https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip',
      redirects: [],
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 28,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'github.com',
    protocol: 'https:',
    _redirectable: Writable {
      _events: [Object],
      _writableState: [WritableState],
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _eventsCount: 3,
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip',
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false
    },
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'user-agent': [Array],
      'accept-encoding': [Array],
      host: [Array]
    },
    [Symbol(errored)]: null,
    [Symbol(kHighWaterMark)]: 16384,
    [Symbol(kRejectNonStandardBodyWrites)]: false,
    [Symbol(kUniqueHeaders)]: null
  },
  response: {
    status: 404,
    statusText: 'Not Found',
    headers: Object [AxiosHeaders] {
      server: 'GitHub.com',
      date: 'Mon, 01 Apr 2024 00:47:22 GMT',
      'content-type': 'text/plain; charset=utf-8',
      vary: 'X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With',
      'cache-control': 'no-cache',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      'x-frame-options': 'deny',
      'x-content-type-options': 'nosniff',
      'x-xss-protection': '0',
      'referrer-policy': 'no-referrer-when-downgrade',
      'content-security-policy': "default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'",
      'content-length': '29',
      'x-github-request-id': 'C410:12C042:134222C:19C5A99:660A041A'
    },
    config: {
      transitional: [Object],
      adapter: [Array],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [Object [AxiosHeaders]],
      responseType: 'arraybuffer',
      method: 'get',
      url: 'https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip',
      data: undefined
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      socket: [TLSSocket],
      _header: 'GET /nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/1.6.8\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: github.com\r\n' +
        'Connection: keep-alive\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'github.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    data: <Buffer 4e 6f 74 20 46 6f 75 6e 64>
  }
}
init devnet config folder: /home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/target/devnet
CKB error: /bin/sh: 1: /home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/target/ckb/ckb: not found

modified  /home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/target/devnet/ckb-miner.toml
CKB-Miner error: /bin/sh: 1: /home/username/.nvm/versions/node/v20.12.0/lib/node_modules/@offckb/cli/target/ckb/ckb: not found
RetricSu commented 8 months ago

can you share your PC info, operating system, arch, etc?

jordanmack commented 8 months ago

can you share your PC info, operating system, arch, etc?

Host: Windows 11 Pro 64-bit, Intel 64, 32GB RAM VM: Ubuntu v20.04 LTS, Intel 64, 4GB RAM

jordanmack commented 8 months ago

If you look closely at the error, you will see it tried to download the following:

https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip

The extension is wrong. The correct URL is:

https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.tar.gz

RetricSu commented 8 months ago

If you look closely at the error, you will see it tried to download the following:

https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.zip

The extension is wrong. The correct URL is:

https://github.com/nervosnetwork/ckb/releases/download/v0.113.1/ckb_v0.113.1_x86_64-unknown-linux-gnu.tar.gz

ah I see, linux binary ends up with different extension. I will pull a pr to fix this, thank you for your report

RetricSu commented 8 months ago
RetricSu commented 8 months ago

@jordanmack can you try if newest version 0.1.0 solve your issue?

jordanmack commented 7 months ago

Yes, this is fixed in v0.1.0.