安装Zombie.js错误:ReferenceError:集合未定义.我究竟做错了什么? [英] Installing Zombie.js Error: ReferenceError: Set is not defined. What am I doing wrong?

查看:71
本文介绍了安装Zombie.js错误:ReferenceError:集合未定义.我究竟做错了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我目前正在阅读Ethan Brown撰写的"使用Node and Express的Web开发"(顺便说一句,这对于那些学习Node和Express的人来说是一本好书),我卡在第5章-质量保险中.

Background: I'm currently reading "Web Development with Node and Express" by Ethan Brown (great book by the way for those learning node and express) and I got stuck on Chapter 5 - Quality Insurance.

一切运行顺利.首先,我运行以下命令:

Everything was running smooth. First I ran the following:

npm install --save-dev摩卡

npm install --save-dev mocha

npm install -g摩卡

npm install -g mocha

npm install --save-dev chai

npm install --save-dev chai

npm install --save-dev僵尸

npm install --save-dev zombie

问题:然后,我按照书中的说明跑了:

Problem: Then I ran (as the book instructed):

mocha -u tdd -R spec qa/tests-crosspage.js 2>/dev/null

mocha -u tdd -R spec qa/tests-crosspage.js 2>/dev/null

但是这没做任何事情.所以我跑了:

But this wasn't doing anything. So then I ran:

mocha -u tdd -R spec qa/tests-crosspage.js

mocha -u tdd -R spec qa/tests-crosspage.js

然后出现此错误:

/Users/esanz91/Desktop/CodingNotes/Node/MySite/node_modules/zombie/node_modules/jsdom/lib/jsdom/level2/html.js:405 var nonInheritedTags = new Set([

/Users/esanz91/Desktop/CodingNotes/Node/MySite/node_modules/zombie/node_modules/jsdom/lib/jsdom/level2/html.js:405 var nonInheritedTags = new Set([

ReferenceError:未定义集

ReferenceError: Set is not defined

版本: 为了给大家一个主意,我安装了以下版本.

Versions: Just to give you guys an idea, I have the following versions installed.

cmd:

npm列表--depth = 0

npm list --depth=0

结果:

├──chai@2.2.0

├── chai@2.2.0

├──express@4.12.3

├── express@4.12.3

├──express3-handlebars@0.5.2

├── express3-handlebars@0.5.2

├──mocha@2.2.4

├── mocha@2.2.4

└──zombie@4.0.7

└── zombie@4.0.7

此外,我正在节点0.10上运行.

Also, I'm running on Node 0.10.

如何解决此问题?

谢谢!

推荐答案

我找到了自己问题的答案.我实际上需要将Zombie 4.0.7降级到3.1.x,以便mocha test命令可以在Node 0.10上使用.

I found the answer to my own question. I actually needed to downgrade Zombie 4.0.7 to 3.1.x so that the mocha test command could work with Node 0.10.

Edit1:我决定将Node版本升级到0.12,将Zombie版本升级到4.0.7,这也可行. (似乎与Node 0.10和Zombie 4.0.7不兼容...)

I decided to upgrade my Node version to 0.12 and my Zombie version back up to 4.0.7 and that worked too. (seems like Node 0.10 and Zombie 4.0.7 not compatible...)

Edit2:对于阅读本书的任何人,建议您查看github repo 由作者本人.看一下package.json文件,看看他使用哪个模块版本.

For anyone reading the book, I suggest looking at the github repo by the author himself. Take a look at the package.json file to see which version of the modules he uses.

这篇关于安装Zombie.js错误:ReferenceError:集合未定义.我究竟做错了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆