TypeError:undefined不是构造函数(评估'require('webpage')。create()')

时间:2020-05-05 18:43:49

标签: javascript node.js web-scraping phantomjs casperjs

该项目昨天运行良好。今天,运行

后我收到错误输出

$ casperjs scraper.js

在再次运行该项目之前,我试图重新下载casperjs和phantomjs,我认为这是问题所在,但我不确定如何解决该问题。

casperjs和phantomjs版本:

Nates-MacBook-Pro:my-email-scraper natehansel$ phantomjs --version
2.1.1
Nates-MacBook-Pro:my-email-scraper natehansel$ casperjs --version
Error: Cannot find module 'path'

  phantomjs://platform/bootstrap.js:299 in require
  phantomjs://platform/bootstrap.js:263 in require
  phantomjs://platform/system.js:7
1.1.4
Nates-MacBook-Pro:my-email-scraper natehansel$ 

这是完整的错误输出。

Error: Cannot find module 'path'

  phantomjs://platform/bootstrap.js:299 in require
  phantomjs://platform/bootstrap.js:263 in require
  phantomjs://platform/system.js:7
TypeError: undefined is not a constructor (evaluating 'require('webpage').create()')
  /Users/natehansel/Desktop/Code-Projects/My-Email-Scraper/phantomjs:/platform/casper.js:2922 in createPage
  /Users/natehansel/Desktop/Code-Projects/My-Email-Scraper/phantomjs:/platform/casper.js:1895 in start
  /Users/natehansel/Desktop/Code-Projects/My-Email-Scraper/phantomjs:/code/scraper.js:59 in scrape
Nates-MacBook-Pro:my-email-scraper natehansel$ 

这是我的javascript文件的标题

var casper = require('casper').create();
var build = {
    emails: [],
    currentPage: 1,
    currentLocation: 0,
    proceed: true,
    links: [],
    email: undefined
};

0 个答案:

没有答案