Reputation: 780
I have downloaded and installed node.js, and now setting up my development environment with my AWS account. Downloading the AWS Javascript SDK looks fine, but I am having a problem initializing my account with it's credentials. After using numerous approaches, it might have to do something with a command line (terminal) configuration? Any suggestions would be appreciated!!
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
[email protected] node_modules/aws-sdk
├── [email protected]
└── [email protected] ([email protected])
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$
My config.json file is saved in both the local director as well as the /node_modules/aws-sdk/config.json directory that is made after installing the AWS SDK. The format in the config.json is as follows:
{ "accessKeyId": "akid", "secretAccessKey": "secret", "region": "us-west-2" }
The installation process I am following is straight from the Amazon Web Services Javascript documentation page they provide: http://aws.amazon.com/sdkfornodejs/
Upvotes: 1
Views: 1994
Reputation: 12441
Looks like you are attempting to run this directly in a bash shell. You need to either try this in the node repl or write a small node app.
Write a quick test.js
file that looks like this and place it in the root of your project:
var AWS = require('aws-sdk');
var util = require('util');
AWS.config.loadFromPath('./config.json');
console.log(util.inspect(AWS.config));
Then run it with node:
node test.js
Upvotes: 3