I'm new to Node.js and I'm trying to get a Flickr API working on my local machine: https://github.com/ciaranj/flickrnode I have installed the flickr module with npm install flickr.
The simplest call is:
var FlickrAPI= require('flickr').FlickrAPI;
var sys= require('sys');
var flickr= new FlickrAPI(your_api_key_here);
// Search for photos with a tag of 'badgers'
flickr.photos.search({tags:'badgers'}, function(error, results) {
sys.puts(sys.inspect(results));
});
I've changed 'sys' to 'util' as node prompted me to and added my api key so I'm calling:
var FlickrAPI= require('flickr').FlickrAPI;
var sys= require('util');
var flickr= new FlickrAPI('...');
// Search for photos with a tag of 'badgers'
flickr.photos.search({tags:'badgers'}, function(error, results) {
sys.puts(sys.inspect(results));
});
Running node myfile.js, I get:
var flickr= new FlickrAPI('a513719086ba8c3a28d2c7726939b58e');
^
TypeError: undefined is not a function
at Object.<anonymous> (/home/charm/ciaranj-flickrnode-8a9d85f/lib/simple.js:3:13)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)
at EventEmitter._tickCallback (node.js:190:38)
Does anyone know how I overcome this problem?
Thanks!
npm install flickr
installs https://github.com/sujal/node-flickr, not the one you're looking for. How to install a node.js module without using npm? explains how to install node packages manually