Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while building: Cannot find type definition file for 'paho-mqtt'. #629

Closed
ildar-icoosoft opened this issue Apr 11, 2018 · 8 comments
Closed
Labels
PubSub Related to PubSub category question General question

Comments

@ildar-icoosoft
Copy link

Do you want to request a feature or report a bug? bug

What is the current behavior?

When I build my project I get this error in console:

[13:15:45]  typescript: node_modules/aws-amplify/lib/PubSub/Providers/MqttOverWSProvider.d.ts, line: 1 
            Cannot find type definition file for 'paho-mqtt'. 

       L1:  import { Client } from 'paho-mqtt';
       L2:  import * as Observable from 'zen-observable';

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions?

aws-amplify 0.2.14

@richardzcode
Copy link
Contributor

Hey @ildar-icoosoft could you run npm install @types/paho-mqtt?

@nidsharm nidsharm added PubSub Related to PubSub category question General question labels Apr 11, 2018
@ildar-icoosoft
Copy link
Author

ildar-icoosoft commented Apr 12, 2018

@richardzcode Why does aws-amplify has not paho-mqtt dependency in package.json? I don't want to know about all your dependencies. This is a bug and you should not close this issue. Also I see nothing about npm install @types/paho-mqtt in your documentation

@ghost
Copy link

ghost commented Apr 12, 2018

Followed the documentation and looked at nothing else, had the same issue on building an Angular application from scratch. Thankfully someone had a similar issue.

@Jasminou
Copy link

@mg131 how did you solve this problem ?

@mlabieniec
Copy link
Contributor

@ildar-icoosoft thanks for the feedback, agreed, this should be added we will add this into the next release.

@ghost
Copy link

ghost commented Apr 14, 2018

@Jasminou I created a new app through Angular CLI (CLI version 1.7.4 and Node at version 9.11.1 if that matters).

ng new <app-name>

After that, the only package I installed was aws-amplify.

npm install --save aws-amplify

Now, if you start using amplify (I only used Auth as a test) and building your application using ng serve, you'd notice a ton of errors pop up.

ERROR in node_modules/aws-amplify/lib/PubSub/Providers/MqttOverWSProvider.d.ts(1,23): error TS2688: Cannot find type definition file for 'paho-mqtt'.
node_modules/aws-amplify/lib/PubSub/Providers/MqttOverWSProvider.d.ts(2,23): error TS2688: Cannot find type definition file for 'zen-observable'.
node_modules/aws-amplify/lib/PubSub/Providers/PubSubProvider.d.ts(1,23): error TS2688: Cannot find type definition file for 'zen-observable'.
node_modules/aws-amplify/lib/PubSub/PubSub.d.ts(1,23): error TS2688: Cannot find type definition file for 'zen-observable'.
node_modules/aws-amplify/lib/PubSub/types/Provider.d.ts(1,23): error TS2688: Cannot find type definition file for 'zen-observable'.
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(1146,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/appsync.d.ts(248,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(2581,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(448,35): 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(3026,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/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/iot.d.ts(4325,27): 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(237,22): 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/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(372,23): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lambda.d.ts(373,28): error TS2304: Cannot find name 'Buffer'.
node_modules/aws-sdk/clients/lexmodelbuildingservice.d.ts(306,23): 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/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/mobile.d.ts(106,26): 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/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'.
node_modules/aws-sdk/clients/sagemakerruntime.d.ts(24,26): 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(4580,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/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(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/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/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/lib/services/glacier.d.ts(10,28): error TS2304: Cannot find name 'Buffer'.

To fix the missing type definition files:
npm install --save-dev @types/paho-mqtt this will fix only the first error,
npm install --save-dev @types/zen-observable should fix the zen-observable missing type definition

The remaining errors are due to missing typings on the aws-sdk package. You can view a fix for that here: https://github.com/aws/aws-sdk-js/issues/1271

Based on the discussion on that link:
Install node typings npm install --save-dev @types/node and then adding "types": ["node"] to the tsconfig.app.json inside the src folder generated by the Angular CLI. This should fix the last remaining errors.

I don't know if there are other errors though as I only used the Auth module as a test.

@Jasminou
Copy link

@mg131 yes thx this is what i did after few research thx :)

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PubSub Related to PubSub category question General question
Projects
None yet
Development

No branches or pull requests

6 participants