Cannot find module 'helmet' or its corresponding type declarations
jmd9019 opened this issue · comments
Facing type definitions error
"helmet": "^7.0.0"
TS config file
{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"baseUrl": "./",
"rootDir": "./src",
"outDir": "./dist",
"esModuleInterop": true,
"sourceMap": false,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
}
}
Sorry about this.
Could you create a small sample app that reproduces this problem?
I did a bunch of work to make sure various TypeScript setups behave, so I'm surprised to see this.
"helmet": "^6.0.1"
This version works if I try using other higher version it's causing an issue.
Also I tried with dummy project there latest version is working i.e "helmet": "^7.0.0" its not working on our project only. Even builds are failing with same errors so its not specific to PC
Tested on
Windows 11, node 18.14.0
Ubuntu 20.04 node:lts-alpine3.17
Now it started to work my be something to do with the typescript version
I was using v4.8 now updated to v5.0, now it's working
Glad your problem is solved. Let me know if you experience other problems.
FWIW: I had the same issue and could fix it by upgrading TypeScript
Not working for me, even though I updated my typescript version to 5.1.6
. Downgrading helmet
from 7.0.0
to 6.x.x
works.