I installed aws-sdk using the below command
我使用下面的命令安装了aws-sdk
npm install --save aws-sdk
and i get an error
我收到一个错误
TypeError AWS.KinesisVideo is not a constructor
TypeError AWS.KinesisVideo不是构造函数
for the below code
对于以下代码
var kinesisvideo = new AWS.KinesisVideo();
AWS.IAM is not a constructor JavaScript SDK post mentioned the error could be because the KinesisVideo module isn't present.
AWS.IAM不是构造函数JavaScript SDK帖子,提到错误可能是因为KinesisVideo模块不存在。
My question is how do i install all modules of aws-sdk via npm.
我的问题是如何通过npm安装aws-sdk的所有模块。
Thanks
谢谢
2 个解决方案
#1
4
There are 2 main methods of downloading the full AWS SDK for browsers (load it in using a <script>
tag) and Node.js backends.
下载用于浏览器的完整AWS SDK(使用
Download a custom SDK from the AWS website
从AWS网站下载自定义SDK
You can choose which modules and services to download in the online SDK builder at https://sdk.amazonaws.com/builder/js/
您可以在https://sdk.amazonaws.com/builder/js/上的在线SDK构建器中选择要下载的模块和服务。
Click Select All Services and click Build to download everything.
单击Select All Services,然后单击Build以下载所有内容。
Use the CLI to build the SDK
使用CLI构建SDK
Clone the official AWS SDK GitHub repository.
克隆官方AWS SDK GitHub存储库。
<!-- language: lang-none --> git clone git://github.com/aws/aws-sdk-js cd aws-sdk-js
After you clone the repository, download the dependency modules for both the SDK and build tool via the following command:
克隆存储库后,通过以下命令下载SDK和构建工具的依赖关系模块:
npm install
You can now build a packaged version of the SDK from the command line interface.
您现在可以从命令行界面构建SDK的打包版本。
Execute the following command to build the SDK with all services and API versions included:
执行以下命令以构建包含所有服务和API版本的SDK:
node dist-tools/browser-builder.js all > aws-sdk-full.js
If you want a minified bundle, set the
MINIFY
environment variable.如果需要缩小捆绑包,请设置MINIFY环境变量。
MINIFY=1 node dist-tools/browser-builder.js > aws-sdk-full.js
*You must have Git and npm installed for this to work.
*你必须安装Git和npm才能工作。
Extra resources:
额外资源:
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/building-sdk-for-browsers.html
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/building-sdk-for-browsers.html
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/installing-jssdk.html
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/installing-jssdk.html
https://github.com/aws/aws-sdk-js
https://github.com/aws/aws-sdk-js
https://www.npmjs.com/package/aws-sdk
https://www.npmjs.com/package/aws-sdk
#2
2
No. There is no way to install all modules together using npm.
不可以。使用npm无法将所有模块安装在一起。
But, You can use the SDK-builder tool from aws-sdk-js repo to create a minified bundle of ALL the AWS Services and include that bundle using <script>
tag.
但是,您可以使用aws-sdk-js repo中的SDK-builder工具创建所有AWS服务的缩小捆绑包,并使用
The command to generate a bundle of ALL the services:
生成所有服务包的命令:
node dist-tools/browser-builder.js all > aws-sdk-full.js
node dist-tools / browser-builder.js all> aws-sdk-full.js
Check out this link for full-steps.
查看此链接以了解完整步骤。
Hope this helps.
希望这可以帮助。