When I do
npm install aws-sdk
in Angular 7, I get an error
Error TS2580: Cannot find name 'Buffer'.
Do you need to install type definitions for node? Try npm i @types/node
and even though I do run install npm i @types/node
, I am still getting the same error:
The AWS SDK for JavaScript simplifies use of AWS Services by providing a set of libraries that are consistent and familiar for JavaScript developers. It provides support for API lifecycle consideration such as credential management, retries, data marshaling, serialization, and deserialization.
To resolve this issue, you can try to add in your tsconfig.app.json
the following line:
"types": ["node"]
Angular is complaining because some node environment types are needed.
Please modify your files as follows:
// aws-sdk requires global to exist
(window as any).global = window;
to /src/polyfills.ts and
"types": ["node"]
to compilerOptions block in /src/tsconfig.app.json
credit to: afaneh262
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With