エラーがいっぱい出ました。イライラ度マックスです。
AngularにAWSのライブラリを入れました。入れた理由は「Angular×Cognito」を試してみたかったからです。
ライブラリを入れると、アホみたいにエラーが出ました。
今日も無理やり落ち着かせて対処します。
目次
実際に出たエラー
実際に出たエラーです。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
ERROR in node_modules/aws-sdk/clients/acm.d.ts(133,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/acm.d.ts(135,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/acm.d.ts(469,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/acm.d.ts(471,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/acmpca.d.ts(308,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/acmpca.d.ts(310,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/acmpca.d.ts(378,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/apigateway.d.ts(1150,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/apigatewaymanagementapi.d.ts(24,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/appsync.d.ts(317,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/clouddirectory.d.ts(1582,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. 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 TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/cloudtrail.d.ts(141,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/cloudwatch.d.ts(851,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/codecommit.d.ts(728,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/codecommit.d.ts(1861,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts(2604,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/directconnect.d.ts(1279,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/dms.d.ts(513,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/dynamodb.d.ts(655,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/dynamodbstreams.d.ts(92,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/ec2.d.ts(3718,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/ecr.d.ts(794,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/firehose.d.ts(202,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/glacier.d.ts(8,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/glacier.d.ts(1314,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/iam.d.ts(1243,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/iam.d.ts(3563,35): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/iot.d.ts(6110,27): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/iotanalytics.d.ts(1195,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/iotdata.d.ts(72,30): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/iotdata.d.ts(73,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/kinesis.d.ts(315,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/kinesisanalyticsv2.d.ts(1892,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(7,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/kinesisvideoarchivedmedia.d.ts(188,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(7,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/kinesisvideomedia.d.ts(52,25): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/kms.d.ts(376,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/kms.d.ts(1146,31): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/lambda.d.ts(7,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/lambda.d.ts(476,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/lambda.d.ts(477,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/lexmodelbuildingservice.d.ts(306,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. 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 TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/mediastoredata.d.ts(7,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/mediastoredata.d.ts(198,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/mobile.d.ts(106,26): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/pinpoint.d.ts(3729,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/pinpointemail.d.ts(1257,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/polly.d.ts(8,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/polly.d.ts(94,29): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/rdsdataservice.d.ts(129,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/rekognition.d.ts(1171,27): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/s3.d.ts(12,24): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/clients/s3.d.ts(868,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/s3.d.ts(1245,42): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/s3.d.ts(3769,15): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/s3.d.ts(3999,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/sagemakerruntime.d.ts(24,26): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/secretsmanager.d.ts(630,34): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/ses.d.ts(1514,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/sns.d.ts(275,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/sqs.d.ts(216,24): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/ssm.d.ts(5448,48): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/support.d.ts(336,22): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/translate.d.ts(197,33): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/waf.d.ts(664,39): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/clients/wafregional.d.ts(708,39): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. 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/dynamodb/document_client.d.ts(2,25): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(103,30): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/lib/dynamodb/document_client.d.ts(416,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/lib/event-stream/event-stream.d.ts(1,55): error TS2503: Cannot find namespace 'NodeJS'. 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 TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/lib/request.d.ts(1,25): error TS2307: Cannot find module 'stream'. node_modules/aws-sdk/lib/request.d.ts(145,45): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/lib/request.d.ts(281,50): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. node_modules/aws-sdk/lib/services/glacier.d.ts(10,28): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. |
「npm i @types/node」をやってみたよ!
エラーが大量に出ていますが、基本的に同じことが書かれています。
「Try npm i @types/node.」。
つまり、「npm i @types/node」というコマンドを打ってみてちょんまげって言われています。打ってあげましょう。
1 |
> npm i @types/node |
これで解決するかと思いましたが、全く変わりませんでした。騙されました。
「tsconfig.app.json」に「”types”: [“node”]」を設定
色々ググってみると、どうやら「tsconfig.app.json」に「“types”: [“node”]」と記載しなければならないそうです。
こんな感じです。
1 2 3 4 5 6 7 8 9 10 11 |
{ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "types": ["node"] }, "exclude": [ "test.ts", "**/*.spec.ts" ] } |
おすすめ本
Angularの勉強をするならこの2冊がおすすめです!
まとめ
何の設定やねんって感じですが、エラーが大量に出た時は「AWSうざっ」て思いました。
ただ、「“types”: [“node”]」って設定するだけなんですが、知らなければアホみたいに時間を取られてしまいます。
僕は理屈で物事を考えられないので、これを解決するのに1時間くらいかかりました。
今回の記事が誰かのためになれば幸いです。