我已经下载并安装了 node.js,现在使用我的 AWS 账户设置我的开发环境。下载 AWS Javascript SDK 看起来不错,但我在使用它的凭证初始化我的账户时遇到问题。在使用了许多方法之后,它可能需要通过命令行(终端)配置来做些什么?任何建议,将不胜感激!!
Macintosh-27:d3 Examples patrickreynolds$ npm install aws-sdk
npm http GET https://registry.npmjs.org/aws-sdk
npm http 304 https://registry.npmjs.org/aws-sdk
npm http GET https://registry.npmjs.org/xml2js/0.2.4
npm http GET https://registry.npmjs.org/xmlbuilder
npm http 304 https://registry.npmjs.org/xmlbuilder
npm http 304 https://registry.npmjs.org/xml2js/0.2.4
npm http GET https://registry.npmjs.org/sax
npm http 304 https://registry.npmjs.org/sax
aws-sdk@1.5.2 node_modules/aws-sdk
├── xmlbuilder@0.4.2
└── xml2js@0.2.4 (sax@0.5.5)
Macintosh-27:d3 Examples patrickreynolds$ AWS.config.loadFromPath('./config.json');
-bash: syntax error near unexpected token `'./config.json''
Macintosh-27:d3 Examples patrickreynolds$ var AWS = require('aws-sdk');
-bash: syntax error near unexpected token `('
Macintosh-27:d3 Examples patrickreynolds$
我的 config.json 文件保存在本地目录以及安装 AWS 开发工具包后创建的 /node_modules/aws-sdk/config.json 目录中。config.json 中的格式如下:
{ "accessKeyId": "akid", "secretAccessKey": "secret", "region": "us-west-2" }
我关注的安装过程直接来自他们提供的 Amazon Web Services Javascript 文档页面:http: //aws.amazon.com/sdkfornodejs/