[英]'TypeError: undefined is not a function' error when using 'flickrnode' API
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. 我是Node.js的新手,我正在尝试在本地计算机上使用Flickr API: https : //github.com/ciaranj/flickrnode我已经使用npm install flickr安装了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: 我已将“ sys”更改为“ util”,因为节点提示我并添加了我的api密钥,所以我在打电话:
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: 运行节点myfile.js,我得到:
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. npm install flickr
会安装https://github.com/sujal/node-flickr ,而不是您要寻找的那个。 How to install a node.js module without using npm? 如何不使用npm来安装node.js模块? explains how to install node packages manually
说明如何手动安装节点软件包
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.