Phantomjs 找不到模块';卡斯珀';1.1测试版
此命令正在工作:Phantomjs 找不到模块';卡斯珀';1.1测试版,phantomjs,casperjs,Phantomjs,Casperjs,此命令正在工作: /usr/local/Cellar/casperjs/1.0.2/libexec/bin/casperjs myfile.coffee 现在我想使用1.1,如下所示: /usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/casperjs myfile.coffee 但现在我得到了这个错误: Error: Cannot find module 'casper' phantomjs://bootstrap.js:289 p
/usr/local/Cellar/casperjs/1.0.2/libexec/bin/casperjs myfile.coffee
现在我想使用1.1,如下所示:
/usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/casperjs myfile.coffee
但现在我得到了这个错误:
Error: Cannot find module 'casper'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
TypeError: 'undefined' is not an object (evaluating 'require.patched')
/usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js:197 in patchRequire
报告此错误的人试图通过运行phantomjs来调用casper,但正如您看到的,我正在直接运行casperjs。有什么好处
更新
如果它提供了线索,当我在脚本的第一行调用require=patchRequire(require)
时,我会得到以下错误:
Error: Cannot find module 'casper'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
TypeError: 'undefined' is not an object (evaluating 'require.patched')
/usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js:197 in patchRequire
您的路径似乎不标准。libexec目录中是否包含casperjs包中的所有内容?你是怎么安装的。您使用的是什么linux发行版?我按照这里的说明在我的开发机器(OSX)上安装了它,因此使用
brew install casperjs--devel
1.1版的libexec
文件夹与1.0.2版具有相同的功能,除了Makefile
和docs
。libexec/modules
文件夹有相同的文件,除了它还有一个vendors
文件夹,其中包含coffeescript.js
。