Help us understand the problem. What is going on with this article?

Angularでaws-amplifyを利用する場合のエラー対策

More than 1 year has passed since last update.

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"
  ]
}
Junpei_Takagi
京都の会社でAWS/SORACOM のテクノロジーをふんだんに使ったIoTをやっています。 AWSやSORACOMのカルチャーが好きです! AWS認定ソリューションアーキテクトアソシエイト AWS認定SysOpsアドミニストレーターアソシエイト Salesfoce認定アドミニストレータ/アプリケーションビルダー
https://iot.kyoto
kyoso
AWSとSORACOMを活用した最先端のIoTソリューションをご提案します。
https://iot.kyoto
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした