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

Re-creating package-lock.json fails #1292

Closed
danielpeintner opened this issue Jun 11, 2024 · 7 comments · Fixed by #1302
Closed

Re-creating package-lock.json fails #1292

danielpeintner opened this issue Jun 11, 2024 · 7 comments · Fixed by #1302

Comments

@danielpeintner
Copy link
Member

danielpeintner commented Jun 11, 2024

While working on #1291 I tried to update all dependencies.
Essentially I did the following:

  1. Delete package-lock.json file
  2. Delete any local cache (like node_modules folders etc.)
  3. Run npm install
  4. Run npm dedupe (see chore: increase version to 0.8.2 and fix TD&TM dependency issues #765 (comment))

like mentioned in our README under "Development Internals"

So far so good, no issue. Anyhow, afterwards npm run build does not work and fails since some time. See below the error

> build
> tsc -b && npm run build -w packages/browser-bundle

node_modules/bl/node_modules/@types/readable-stream/index.d.ts:355:9 - error TS2416: Property 'pipe' in type 'Duplex' is not assignable to the same property in base type '_Writable'.
  Type '<S extends _IWritable>(dest: S, pipeOpts?: { end?: boolean | undefined; } | undefined) => S' is not assignable to type '<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; } | undefined) => T'.
    Types of parameters 'dest' and 'destination' are incompatible.
      Type 'T' is not assignable to type '_IWritable'.
        Type 'WritableStream' is not assignable to type '_IWritable'.
          The types returned by 'end(...)' are incompatible between these types.
            Type 'void' is not assignable to type '_IWritable'.

355         pipe<S extends _IWritable>(dest: S, pipeOpts?: { end?: boolean | undefined }): S;
            ~~~~

node_modules/mqtt/node_modules/@types/readable-stream/index.d.ts:355:9 - error TS2416: Property 'pipe' in type 'Duplex' is not assignable to the same property in base type '_Writable'.
  Type '<S extends _IWritable>(dest: S, pipeOpts?: { end?: boolean | undefined; } | undefined) => S' is not assignable to type '<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; } | undefined) => T'.
    Types of parameters 'dest' and 'destination' are incompatible.
      Type 'T' is not assignable to type '_IWritable'.
        Type 'WritableStream' is not assignable to type '_IWritable'.
          The types returned by 'end(...)' are incompatible between these types.
            Type 'void' is not assignable to type '_IWritable'.

355         pipe<S extends _IWritable>(dest: S, pipeOpts?: { end?: boolean | undefined }): S;
            ~~~~

packages/examples/src/bindings/coap/example-client.ts:17:35 - error TS2307: Cannot find module '@node-wot/binding-coap' or its corresponding type declarations.

17 import { CoapClientFactory } from "@node-wot/binding-coap";
                                     ~~~~~~~~~~~~~~~~~~~~~~~~

packages/examples/src/bindings/coap/example-server.ts:17:28 - error TS2307: Cannot find module '@node-wot/binding-coap' or its corresponding type declarations.

17 import { CoapServer } from "@node-wot/binding-coap";
                              ~~~~~~~~~~~~~~~~~~~~~~~~

packages/examples/src/quickstart/presence-sensor.ts:20:34 - error TS2307: Cannot find module '@node-wot/binding-mqtt' or its corresponding type declarations.

20 import { MqttBrokerServer } from "@node-wot/binding-mqtt";
                                    ~~~~~~~~~~~~~~~~~~~~~~~~

packages/examples/src/quickstart/smart-clock.ts:19:28 - error TS2307: Cannot find module '@node-wot/binding-coap' or its corresponding type declarations.

19 import { CoapServer } from "@node-wot/binding-coap";
                              ~~~~~~~~~~~~~~~~~~~~~~~~


Found 6 errors.

@danielpeintner
Copy link
Member Author

The change in package-lock.json that seems to cause issues is the following

image

Not sure what we can do here!?

@danielpeintner
Copy link
Member Author

See attached the package-lock.json file that gets generated. I noticed that there are varying versions for @types/readable-stream:

  • "@types/readable-stream": "^2.3.13"
  • "@types/readable-stream": "^2.3.15"
  • "@types/readable-stream": "^4.0.5",
  • "@types/readable-stream": "4.0.14"

Could it be that there is a change between v2 and v4 that causes the issue/inconsistency?

node-wot itself (package.json wise) has it in root only (and twice as indirect dependency in COAP v2 and MQTT v4)

@danielpeintner
Copy link
Member Author

danielpeintner commented Jun 12, 2024

node-wot itself (package.json wise) has it in root only (and twice as indirect dependency in COAP v2 and MQTT v4)

FYI: updating it to "^4.0.5" doesn't help. I think the issue is that CoAP still uses v2, see

https://github.com/coapjs/node-coap/blob/0ac5017e605b7ab06a703a9b28a5f582b3217b93/package.json#L58

@JKRhb do you know whether there is any plan to upgrade?

EDIT: @types/readable-stream in node-coap are v2 but readable-stream is v4. Could this be an issue?
https://github.com/coapjs/node-coap/blob/0ac5017e605b7ab06a703a9b28a5f582b3217b93/package.json#L64C6-L64C21

@JKRhb
Copy link
Member

JKRhb commented Jul 1, 2024

I've just published a new version of node-coap with updated dependencies :) I hope that will contribute to resolving this issue.

@danielpeintner
Copy link
Member Author

@JKRhb I updated the coap library but I still run into issues, see #1297

@JKRhb
Copy link
Member

JKRhb commented Jul 2, 2024

Hmm, that is very strange :/ But this seems to also occur with other bindings, if I am not mistaken, as the error persists even after removing the CoAP binding from the workspace.

@danielpeintner
Copy link
Member Author

True. I didn't try it before.
It fails for me if I try to use td-tools only.

What I also noticed is that we refer to readable stream in td-tools ts.config.json file

"types": ["node", "readable-stream"],

Does anyone know why we need it? Removing it causes issues with importing debug and ajv-formats ...

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