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

js-libp2p fails to build from master branch #1399

Closed
coder11 opened this issue Oct 4, 2022 · 6 comments
Closed

js-libp2p fails to build from master branch #1399

coder11 opened this issue Oct 4, 2022 · 6 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@coder11
Copy link

coder11 commented Oct 4, 2022

js-libp2p fails to build. It is true for at least this commit: 6ac62da025b5bf20f559cf241deb0fb9020e1418

pavel@pavel-laptop ~/w/f/i/js-libp2p (master)> npm run build

> libp2p@0.39.3 build
> aegir build

[14:19:53] tsc [started]
src/insecure/index.ts:103:9 - error TS2416: Property 'secureOutbound' in type 'Plaintext' is not assignable to the same property in base type 'ConnectionEncrypter'.
  Type '(localId: PeerId, conn: Duplex<Uint8Array, Uint8Array, Promise<void>>, remoteId: PeerId) => Promise<SecuredConnection>' is not assignable to type '(localPeer: PeerId, connection: Duplex<Uint8Array, Uint8Array, Promise<void>>, remotePeer?: PeerId | undefined) => Promise<...>'.
    Types of parameters 'remoteId' and 'remotePeer' are incompatible.
      Type 'PeerId | undefined' is not assignable to type 'PeerId'.
        Type 'undefined' is not assignable to type 'PeerId'.

103   async secureOutbound (localId: PeerId, conn: Duplex<Uint8Array>, remoteId: PeerId): Promise<SecuredConnection> {
            ~~~~~~~~~~~~~~

test/configuration/utils.ts:18:26 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.
  Types of property 'secureOutbound' are incompatible.
    Type '(localId: PeerId, conn: Duplex<Uint8Array, Uint8Array, Promise<void>>, remoteId: PeerId) => Promise<SecuredConnection>' is not assignable to type '(localPeer: PeerId, connection: Duplex<Uint8Array, Uint8Array, Promise<void>>, remotePeer?: PeerId | undefined) => Promise<...>'.

18   connectionEncryption: [new Plaintext()]
                            ~~~~~~~~~~~~~~~

test/core/consume-peer-record.spec.ts:21:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

21         new Plaintext()
           ~~~~~~~~~~~~~~~

test/core/encryption.spec.ts:49:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

49         new Plaintext()
           ~~~~~~~~~~~~~~~

test/core/get-public-key.spec.ts:23:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

23         new Plaintext()
           ~~~~~~~~~~~~~~~

test/core/listening.node.ts:34:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

34         new Plaintext()
           ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:241:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

241         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:274:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

274         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:294:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

294         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:321:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

321         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:350:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

350         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:414:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

414         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:440:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

440         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:463:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

463         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:501:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

501         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.node.ts:537:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

537         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:351:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

351         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:383:37 - error TS2345: Argument of type '{ peerId: PeerId; transports: WebSockets[]; streamMuxers: Mplex[]; connectionEncryption: Plaintext[]; connectionManager: { maxParallelDials: number; maxDialsPerPeer: number; dialTimeout: number; }; }' is not assignable to parameter of type 'RecursivePartial<Libp2pInit>'.
  Types of property 'connectionEncryption' are incompatible.
    Type 'Plaintext[]' is not assignable to type 'RecursivePartial<ConnectionEncrypter[] | undefined>'.
      Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

383     libp2p = await createLibp2pNode(config)
                                        ~~~~~~

test/dialing/direct.spec.ts:405:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

405         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:438:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

438         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:478:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

478         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:506:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

506         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:527:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

527         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:564:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

564         new Plaintext()
            ~~~~~~~~~~~~~~~

test/dialing/direct.spec.ts:590:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

590         new Plaintext()
            ~~~~~~~~~~~~~~~

test/fetch/fetch.node.ts:25:7 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

25       new Plaintext()
         ~~~~~~~~~~~~~~~

test/insecure/compliance.spec.ts:8:11 - error TS2322: Type '() => Promise<Plaintext>' is not assignable to type '(args?: {} | undefined) => Promise<ConnectionEncrypter>'.
  Type 'Promise<Plaintext>' is not assignable to type 'Promise<ConnectionEncrypter>'.
    Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

8     async setup () {
            ~~~~~

  node_modules/@libp2p/interface-compliance-tests/dist/src/index.d.ts:2:5
    2     setup: (args?: SetupArgs) => Promise<T>;
          ~~~~~
    The expected type comes from property 'setup' which is declared here on type 'TestSetup<ConnectionEncrypter, {}>'

test/insecure/plaintext.spec.ts:31:5 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

31     plaintext = new Plaintext()
       ~~~~~~~~~

test/interop.ts:98:28 - error TS2322: Type 'Noise' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.
  Types of property 'secureOutbound' are incompatible.
    Type '(localPeer: PeerId, connection: Duplex<Uint8Array, Uint8Array, Promise<void>>, remotePeer: PeerId) => Promise<SecuredConnection>' is not assignable to type '(localPeer: PeerId, connection: Duplex<Uint8Array, Uint8Array, Promise<void>>, remotePeer?: PeerId | undefined) => Promise<...>'.
      Types of parameters 'remotePeer' and 'remotePeer' are incompatible.
        Type 'PeerId | undefined' is not assignable to type 'PeerId'.

98     connectionEncryption: [new Noise()]
                              ~~~~~~~~~~~

test/registrar/registrar.spec.ts:232:11 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

232           new Plaintext()
              ~~~~~~~~~~~~~~~

test/transports/transport-manager.spec.ts:112:30 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

112       connectionEncryption: [new Plaintext()]
                                 ~~~~~~~~~~~~~~~

test/transports/transport-manager.spec.ts:132:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

132         new Plaintext()
            ~~~~~~~~~~~~~~~

test/transports/transport-manager.spec.ts:152:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

152         new Plaintext()
            ~~~~~~~~~~~~~~~- **Version**:
<!--
Check package.json version
-->


test/upgrading/upgrader.spec.ts:69:9 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

69         new Plaintext()
           ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:86:9 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

86         new Plaintext()
           ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:146:9 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

146         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:153:9 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

153         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:277:9 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

277         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:286:9 - error TS2322: Type 'Plaintext' is not assignable to type 'ConnectionEncrypter'.

286         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:488:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

488         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:510:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

510         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:526:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

526         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:557:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

557         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:571:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

571         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:616:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

616         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:630:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

630         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:678:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

678         new Plaintext()
            ~~~~~~~~~~~~~~~

test/upgrading/upgrader.spec.ts:692:9 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

692         new Plaintext()
            ~~~~~~~~~~~~~~~

test/utils/base-options.browser.ts:20:7 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.
  Types of property 'secureOutbound' are incompatible.
    Type '(localId: PeerId, conn: Duplex<Uint8Array, Uint8Array, Promise<void>>, remoteId: PeerId) => Promise<SecuredConnection>' is not assignable to type '(localPeer: PeerId, connection: Duplex<Uint8Array, Uint8Array, Promise<void>>, remotePeer?: PeerId | undefined) => Promise<...>'.

20       new Plaintext()
         ~~~~~~~~~~~~~~~

test/utils/base-options.ts:16:7 - error TS2322: Type 'Plaintext' is not assignable to type 'RecursivePartial<ConnectionEncrypter>'.

16       new Plaintext()
         ~~~~~~~~~~~~~~~


Found 50 errors in 17 files.

Errors  Files
     1  src/insecure/index.ts:103
     1  test/configuration/utils.ts:18
     1  test/core/consume-peer-record.spec.ts:21
     1  test/core/encryption.spec.ts:49
     1  test/core/get-public-key.spec.ts:23
     1  test/core/listening.node.ts:34
    10  test/dialing/direct.node.ts:241
     9  test/dialing/direct.spec.ts:351
     1  test/fetch/fetch.node.ts:25
     1  test/insecure/compliance.spec.ts:8
     1  test/insecure/plaintext.spec.ts:31
     1  test/interop.ts:98
     1  test/registrar/registrar.spec.ts:232
     3  test/transports/transport-manager.spec.ts:112
    15  test/upgrading/upgrader.spec.ts:69
     1  test/utils/base-options.browser.ts:20
     1  test/utils/base-options.ts:16
[14:19:57] tsc [failed]
[14:19:57] → Command failed with exit code 1: tsc
Command failed with exit code 1: tsc

  • Platform:
    Ubuntu 22.04. But same issue on 20.04 and macs
Linux pavel-laptop 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Severity:

Seems to be:
Critical - System crash, application panic.

Description:

Just build the library according to instructions in repo's readme

Steps to reproduce the error:

> git clone https://github.com/libp2p/js-libp2p.git
> cd js-libp2p
> npm install
> npm run build
@coder11 coder11 added the need/triage Needs initial labeling and prioritization label Oct 4, 2022
@coder11
Copy link
Author

coder11 commented Oct 4, 2022

@folex
Copy link

folex commented Oct 4, 2022

I think having package-lock.json is a must for preventing this kind of problems. Without package-lock.json any transitive dependency update risks libp2p-js build to fail.

@mpetrunic
Copy link
Member

@folex you should delete your package-lock.json to be able to receive new package versions that would fix the build.

@folex
Copy link

folex commented Oct 4, 2022

I don't have any package-lock.json of my own. Same as OP, I've just cloned the repo and tried to build it, and it failed. It's my guess that lacking package-lock.json is at fault.

@coder11
Copy link
Author

coder11 commented Oct 4, 2022

@mpetrunic could you please try cloning the repo afresh and build it according to the instructions?

@mpetrunic
Copy link
Member

@coder11 sorry about that seems like there was a interface release that broke build but should be fixed by #1404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

3 participants