How do create a CapacitorJS plugin? Standard process fails with many errors

Trying to create a plugin according to doc. Using npm init @capacitor/plugin@latest, following the standard process. Then I get bombarded with errors:

% npm run build

> capacitor-test-plugin@0.0.1 build
> npm run clean && npm run docgen && tsc && rollup -c rollup.config.js


> capacitor-test-plugin@0.0.1 clean
> rimraf ./dist


> capacitor-test-plugin@0.0.1 docgen
> docgen --api TestPlugin --output-readme README.md --output-json dist/docs.json


✔️ DocGen Output: /Users/user/dev/capacitor-test-plugin/dist/docs.json
✔️ DocGen Output: /Users/user/dev/capacitor-test-plugin/README.md

../node_modules/@types/cacheable-request/index.d.ts:26:42 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

26         cb?: (response: ServerResponse | ResponseLike) => void
                                            ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:77:51 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

77             listener: (response: ServerResponse | ResponseLike) => void
                                                     ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:81:69 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

81         on(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
                                                                       ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:84:71 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

84         once(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
                                                                         ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:89:51 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

89             listener: (response: ServerResponse | ResponseLike) => void
                                                     ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:95:51 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

95             listener: (response: ServerResponse | ResponseLike) => void
                                                     ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:104:51 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

104             listener: (response: ServerResponse | ResponseLike) => void
                                                      ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:108:70 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

108         off(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
                                                                         ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:112:73 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

112         listeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>;
                                                                            ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:115:76 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

115         rawListeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>;
                                                                               ~~~~~~~~~~~~

../node_modules/@types/cacheable-request/index.d.ts:118:60 - error TS2709: Cannot use namespace 'ResponseLike' as a type.

118         emit(event: 'response', response: ServerResponse | ResponseLike): boolean;
                                                               ~~~~~~~~~~~~


Found 11 errors.

Updating everything to latest (ncu -u && npm i) results in same errors.

What are your node and npm versions?
What’s your operating system?
Did you update any dependencies?

I can’t reproduce on node 18/npm 9 on macOS.

Those errors come from dependencies, in this case @types/cacheable-request, which is not being installed for my plugin, did you install any additional packages?

Thanks for your response, good questions :slightly_smiling_face:

Running macOS on M1, node v20.14.0, npm 10.7.0.

Turns out that after deleting some node_modules folder (and re-installing), even in parent folder, it works now. I thought cacheable-request is used by CapacitorJS, but it seems it was installed by another project, the requirement is gone now.