Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start mvp-dapp failed #271

Open
gpBlockchain opened this issue May 19, 2023 · 4 comments
Open

start mvp-dapp failed #271

gpBlockchain opened this issue May 19, 2023 · 4 comments
Assignees

Comments

@gpBlockchain
Copy link
Contributor

gpBlockchain commented May 19, 2023

commit: e8561f8


gitpod /workspace/kuai/packages/samples (develop) $ cd mvp-dapp/
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ ls
contract  dist  docs  jest.config.js  kuai.config.js  libs  package.json  README.md  src  __tests__  tsconfig.json
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ npm i

> kuai@0.0.1 prepare
> husky install

husky - Git hooks installed

up to date, audited 1333 packages in 3s

146 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ 
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ docker pull redis
Using default tag: latest
latest: Pulling from library/redis
9e3ea8720c6d: Pull complete 
7bb0a593ef8e: Pull complete 
1563ab48b627: Pull complete 
e71aa54519a0: Pull complete 
e43bffb29bfd: Pull complete 
a8fb6ae3ba1b: Pull complete 
Digest: sha256:ea30bef6a1424d032295b90db20a869fc8db76331091543b7a80175cede7d887
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ docker run --name my-redis -p 6379:6379 -d redis
e80ef948d21e68195f46376b446a4e518038c5981826a55dfdf15dac23751394
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ npm run start:prod

> start:prod
> node ./dist/main.js

Error: connect ECONNREFUSED 127.0.0.1:8114
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8114,
  config: {
    url: 'http://127.0.0.1:8114',
    method: 'post',
    data: '{"id":7055,"method":"get_block_by_number","params":["0x0"],"jsonrpc":"2.0"}',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'axios/0.21.4',
      'Content-Length': 75
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 30000,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    }
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      constructed: true,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false,
      closeEmitted: false,
      [Symbol(kOnFinished)]: []
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError],
      socket: [Function: destroyOnTimeout]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'http:',
      path: '/',
      method: 'POST',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: '127.0.0.1',
      port: '8114',
      nativeProtocols: [Object],
      pathname: '/'
    },
    _ended: false,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 75,
    _requestBodyBuffers: [ [Object] ],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 75,
      _hasBody: true,
      _trailer: '',
      finished: false,
      _headerSent: true,
      _closed: false,
      socket: [Socket],
      _header: 'POST / HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'User-Agent: axios/0.21.4\r\n' +
        'Content-Length: 75\r\n' +
        'Host: 127.0.0.1:8114\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '127.0.0.1',
      protocol: 'http:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'http://127.0.0.1:8114/',
    _timeout: null,
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}
npm ERR! Lifecycle script `start:prod` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: kuai-mvp-dapp 
npm ERR!   at location: /workspace/kuai/packages/samples/mvp-dapp 

cp env.example to .env , try add NETWORK=testnet in .env ,but it still failed.
image
image

@Keith-CY
Copy link
Member

Keith-CY commented May 19, 2023

commit: e8561f8


gitpod /workspace/kuai/packages/samples (develop) $ cd mvp-dapp/
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ ls
contract  dist  docs  jest.config.js  kuai.config.js  libs  package.json  README.md  src  __tests__  tsconfig.json
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ npm i

> kuai@0.0.1 prepare
> husky install

husky - Git hooks installed

up to date, audited 1333 packages in 3s

146 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ 
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ docker pull redis
Using default tag: latest
latest: Pulling from library/redis
9e3ea8720c6d: Pull complete 
7bb0a593ef8e: Pull complete 
1563ab48b627: Pull complete 
e71aa54519a0: Pull complete 
e43bffb29bfd: Pull complete 
a8fb6ae3ba1b: Pull complete 
Digest: sha256:ea30bef6a1424d032295b90db20a869fc8db76331091543b7a80175cede7d887
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ docker run --name my-redis -p 6379:6379 -d redis
e80ef948d21e68195f46376b446a4e518038c5981826a55dfdf15dac23751394
gitpod /workspace/kuai/packages/samples/mvp-dapp (develop) $ npm run start:prod

> start:prod
> node ./dist/main.js

Error: connect ECONNREFUSED 127.0.0.1:8114
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8114,
  config: {
    url: 'http://127.0.0.1:8114',
    method: 'post',
    data: '{"id":7055,"method":"get_block_by_number","params":["0x0"],"jsonrpc":"2.0"}',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'axios/0.21.4',
      'Content-Length': 75
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 30000,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    }
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      constructed: true,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false,
      closeEmitted: false,
      [Symbol(kOnFinished)]: []
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError],
      socket: [Function: destroyOnTimeout]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'http:',
      path: '/',
      method: 'POST',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: '127.0.0.1',
      port: '8114',
      nativeProtocols: [Object],
      pathname: '/'
    },
    _ended: false,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 75,
    _requestBodyBuffers: [ [Object] ],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 75,
      _hasBody: true,
      _trailer: '',
      finished: false,
      _headerSent: true,
      _closed: false,
      socket: [Socket],
      _header: 'POST / HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'User-Agent: axios/0.21.4\r\n' +
        'Content-Length: 75\r\n' +
        'Host: 127.0.0.1:8114\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '127.0.0.1',
      protocol: 'http:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'http://127.0.0.1:8114/',
    _timeout: null,
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}
npm ERR! Lifecycle script `start:prod` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: kuai-mvp-dapp 
npm ERR!   at location: /workspace/kuai/packages/samples/mvp-dapp 

cp env.example to .env , try add NETWORK=testnet in .env ,but it still failed. image image

It should be related to missing of the local node because it blames as

Error: connect ECONNREFUSED 127.0.0.1:8114

We should add a note for this @Keith-CY , and add a clear error message for it @PainterPuppets

@Keith-CY
Copy link
Member

User config is not injected into the project at https://github.com/ckb-js/kuai/blob/develop/packages/core/src/config/config-loading.ts#L45, instead, the path of user config file is imported by accident. @PainterPuppets

@PainterPuppets
Copy link
Contributor

👌

Keith-CY added a commit that referenced this issue May 25, 2023
This commit adds 'how to run/connect to a ckb node' in the
docs of mvp dapp, which is required before running the dapp.

Ref: #271 (comment)
@Keith-CY
Copy link
Member

👌

The bug mentioned above should be fixed first because it blocks users' onboarding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants