CodeGenieApp / CodeGenieApp/serverless-express

Cannot find module 'aws-lambda' with pnp

Aperta
#621 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
5.3k
Fork
674
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da package.json nel commit indicato e verifica come è dichiarato @types/aws-lambda. Riproduci il problema con tsc -b usando Yarn Plug'n'Play, quindi verifica che i metadati delle dipendenze del pacchetto consentano di risolvere i tipi aws-lambda senza il workaround .yarnrc.yml packageExtensions.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, node.js, typescript
Ambito
backend, build-system, cloud
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.