Cannot find module 'aws-lambda' with pnp
saveman71 opened this issue · 0 comments
saveman71 commented
I have the following error when running tsc -b
:
../../.yarn/cache/@vendia-serverless-express-npm-4.10.1-f73485d9b7-083c393170.zip/node_modules/@vendia/serverless-express/src/configure.d.ts:2:25 - error TS2307: Cannot find module 'aws-lambda' or its corresponding type declarations.
It seems like adding @types/aws-lambda
to peer dependencies should be enough to fix. Currently it's only in devDeps https://github.com/vendia/serverless-express/blob/0909ec4ffd09d9fd22538257b721b7d076d03732/package.json#L79
I'm still figuring out how exactly pnp works so this might not be relevant. For now I'm fixing it with the packageExtensions
field in .yarnrc.yml
:
packageExtensions:
"@vendia/serverless-express@*":
peerDependencies:
"@types/aws-lambda": "*"
peerDependenciesMeta:
"@types/aws-lambda":
optional: true
It seems like pnp is quite strict about how it finds required deps and if they're not listed in the package.json they're just not found. Feel free to close if not relevant, at least future users of this package + pnp will know the workaround.