I am trying to install hippie api testing module. However, I keep getting an error when I try to run a simple script with hippie.

我正在尝试安装hippie api测试模块。但是,当我尝试使用hippie运行一个简单的脚本时,我一直收到错误。

I did: npm install hippie

我做了:npm安装嬉皮士

And created a file called: search.js

并创建了一个名为:search.js的文件

The code inside search.js is as simple as this:

search.js中的代码就像这样简单:

var api = require('hippie');
hippie()
.json()
.get('https://api.github.com/users/vesln')
.expectStatus(200)
.end(function(err, res, body) {
  if (err) throw err;
});

And I run: node search.js

我运行:node search.js

It keeps getting me an error says

它不断给我一个错误说

ReferenceError: hippie is not defined

Any idea?

1 个解决方案

#1


1

You saved the reference to the hippie module in variable named api. Either use the api variable or rename it.

您在名为api的变量中保存了对hippie模块的引用。使用api变量或重命名它。

var hippie = require('hippie');
hippie()
    .json()
    .get('https://api.github.com/users/vesln')
    .expectStatus(200)
    .end(function(err, res, body) {
        if (err) throw err;
    });

Or:

var api = require('hippie');
api()
    .json()
    .get('https://api.github.com/users/vesln')
    .expectStatus(200)
    .end(function(err, res, body) {
        if (err) throw err;
    });

更多相关文章

  1. Python和Visual Studio需要安装Node.js模块(Superfeedr Node.js包
  2. 将对象值传递给指令而不是任何其他数据变量
  3. 关于JavaScript变量声明及其初始化的问题
  4. 如何使用变量填充iframe源?
  5. 使用JavaScript多态在子类中创建唯一变量而不覆盖
  6. javascript入门笔记(1)——变量和计算
  7. 从单击使用属性作为变量进行AJAX调用。
  8. AngularJS错误:模块ngAnimate不可用
  9. 在JavaScript中访问PHP变量[重复]

随机推荐

  1. Python爬虫之模拟登录总结
  2. 记一次python爬虫实战,豆瓣电影Top250爬虫
  3. 如何创建一个查询来过滤一列等于另一列同
  4. Python - 去除字符串首尾填充
  5. python 实践 心理测验(by Kim)
  6. Anaconda 添加国内镜像下载OpenCV
  7. 如何有效地扩展/展平pandas数据帧
  8. Python 学习笔记【list的操作方法】
  9. 大神程序员对python的理解与运用
  10. Python多个装饰器的顺序