AngularのSPAから「aws-amplify (aws−sdk)」利用時に、「Buffer」や「stream」が見つからない旨のエラーが発生しました。

ERROR in node_modules/aws-sdk/lib/http_response.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/http_response.d.ts(14,18): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/acm.d.ts(108,37): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/acm.d.ts(110,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/acm.d.ts(401,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/apigateway.d.ts(1121,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/clouddirectory.d.ts(1469,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(42,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/cloudtrail.d.ts(141,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/codecommit.d.ts(1539,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts(2561,31): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/directconnect.d.ts(992,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/dms.d.ts(432,35): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(2,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(93,30): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(274,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/dynamodb.d.ts(466,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/dynamodbstreams.d.ts(92,38): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ec2.d.ts(3006,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ecr.d.ts(767,31): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/firehose.d.ts(156,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/services/glacier.d.ts(10,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/glacier.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/glacier.d.ts(1313,24): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iam.d.ts(1112,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iam.d.ts(3106,35): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iotdata.d.ts(73,30): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/iotdata.d.ts(74,25): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kinesis.d.ts(229,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kms.d.ts(328,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kms.d.ts(962,31): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lambda.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/lambda.d.ts(364,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lambda.d.ts(365,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lexruntime.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/lexruntime.d.ts(35,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/polly.d.ts(8,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/polly.d.ts(70,29): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/rekognition.d.ts(1135,27): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ses.d.ts(1513,32): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/sns.d.ts(275,24): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/sqs.d.ts(216,24): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/ssm.d.ts(4564,48): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/support.d.ts(336,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/waf.d.ts(604,39): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/wafregional.d.ts(648,39): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/mobile.d.ts(106,26): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/mediastoredata.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/mediastoredata.d.ts(199,29): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/appsync.d.ts(240,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(121,25): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(53,25): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/sagemakerruntime.d.ts(24,26): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/lib/config.d.ts(1,34): error TS2307: Cannot find module 'http'.
node_modules/aws-sdk/lib/config.d.ts(2,35): error TS2307: Cannot find module 'https'.
node_modules/aws-sdk/lib/request.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/request.d.ts(132,45): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/s3.d.ts(10,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/s3.d.ts(777,22): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/s3.d.ts(1131,42): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/s3.d.ts(3473,32): error TS2304: Cannot find name 'Buffer'.

少し調査してみましたが、GitHub Isueにそれっぽいのを見つけました。
https://github.com/aws/aws-sdk-js/issues/1944

tsconfig.xxx.jsonの types が空の場合は行ごと削除した方が良いみたいです。

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

 

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015"
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.