'在js文件上运行casperjs时找不到模块fs' [英] 'Can't find module fs' when running casperjs on js file
问题描述
我正在尝试在我拥有的javascript文件上运行CasperJS,当我运行时
I am trying to run CasperJS on a javascript file that I have, and when I run
> casperjs index.js
它说
'CasperError: Cant find module fs'.
index.js的第一行是
The first line of index.js is
var fs = require('fs');
我安装了node,casperjs和phantomjs,为什么不能找到fs?如果我是正确的,fs是Node的文件系统?
I have node, casperjs, and phantomjs installed, why can't it find fs? If I am correct, fs is Node's file system?
更新:我将nodejs添加到我的$ PATH,但仍然没有运气。
UPDATE: I added nodejs to my $PATH, but still no luck.
推荐答案
您是否在项目中安装了PhantomJS / CasperJS模块以及节点fs模块?它们似乎没有很好地混合。
Did you install the PhantomJS/CasperJS modules as well as the node fs module in your project? They don't seem to mix very well.
我遇到了一个问题,安装了所有这些模块,我收到了你上面提到的相同错误信息。
I ran into an issue where installed all of these modules and I was getting the same error message you mentioned above.
CasperError:找不到模块fs
CasperError: Can't find module fs
一旦我卸载节点'fs'模块,一切正常。
Once I uninstalled the node 'fs' module, everything worked fine.
npm uninstall fs
这篇关于'在js文件上运行casperjs时找不到模块fs'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!