ERROR TS2688: Cannot find type definition file for 'keyv'
Asked Answered
F

4

7

We have a code base that is built every night. Last night, it failed to build (without me making changes that were related to NPM libraries).

I got the following error:

ERROR TS2688: Cannot find type definition file for 'keyv'.
The file is in the program because: Entry point for implicit type library 'keyv'.

I found that the keyv library is not in my packages json, but some other packages that are listed in package.json are using it. In the package-lock.json I found @types/keyv is used in several places.

Searching for the types library and looking at the change in the package-lock.json lead to this line, and this is its link:

https://www.npmjs.com/package/@types/keyv "This is a stub types definition. keyv provides its own type definitions, so you do not need this installed."

The packages using 'keyv' tried to use the @types/keyv which is deprecated.

Fushih answered 20/10, 2022 at 14:29 Comment(0)
I
5

npm install -D keyv solved this for me too.

Ithaca answered 27/10, 2022 at 3:44 Comment(0)
F
3

The way I solved it was to add the keyv library to my package.json.

Fushih answered 20/10, 2022 at 14:29 Comment(0)
M
1

npm install -D keyv solved this for me too. but i don't know why!

Mev answered 1/11, 2022 at 7:34 Comment(0)
T
1

I solved it by re-locking package versions: rm package-lock.json && rm -rf node_modules && npm i

The reasons behind why it worked, I have no idea. Perhaps some old version of "keyv" was laying around in "package-lock.json"

Anyway, I think the solution is much better than installing a package that you are not explicitly using in your code base

Teleology answered 7/12, 2022 at 17:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.