简体   繁体   English

使用'flickrnode'API时出现'TypeError:undefined is not function'错误

[英]'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.

相关问题 TypeError:使用highchart时undefined不是函数 - TypeError: undefined is not a function when using highchart 创建指令时出错:TypeError:undefined不是函数 - Error when creating directive: TypeError: undefined is not a function 未捕获的TypeError:undefined在使用highcharts时不是函数 - Uncaught TypeError: undefined is not a function when using highcharts 调用函数时出现错误“未捕获的TypeError:未定义不是函数” - Getting a error “Uncaught TypeError: undefined is not a function” when calling a function 使用ipfs-api时出现错误“ TypeError:无法读取未定义的属性&#39;indexOf&#39;” - Error “TypeError: Cannot read property 'indexOf' of undefined” when using ipfs-api TypeError:无法读取未定义的属性“ 0”(使用在另一个函数中定义的平方时发生错误) - TypeError: Cannot read property '0' of undefined (error occured when using squares which is defined in another function) 错误:未捕获的类型错误:未定义不是函数 - Error: Uncaught TypeError: undefined is not a function React TypeError: Object(...)(...) is undefined when using Context API - React TypeError: Object(...)(...) is undefined when using Context API TypeError:使用mongoDB排序运算符时&#39;undefined&#39;不是函数 - TypeError: 'undefined' is not a function when using mongoDB sort operator Uncaught TypeError:使用ig.AnimationSheet时undefined不是函数 - Uncaught TypeError: undefined is not a function when using ig.AnimationSheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM