简体   繁体   English

NodeJS:使用npm包casperjs

[英]NodeJS: Using npm package casperjs

I have installed casperjs npm module in nodejs. 我已经在nodejs中安装了casperjs npm模块。 Also installed phantomjs npm package before casperjs. 还在casperjs之前安装了phantomjs npm软件包。 Installed using " npm install casperjs --save " But got an exception " Cannot find module casper " 使用“ npm install casperjs --save ”进行安装,但出现异常“ 无法找到模块casper

var casper = require('casper').create();

You simply cannot use CasperJS in NodeJS. 您根本无法在NodeJS中使用CasperJS。

Quote from official docs: 引用官方文档:

While CasperJS is installable via npm, it is not a NodeJS module and will not work with NodeJS out of the box. 虽然CasperJS可通过npm安装,但它不是NodeJS模块,因此无法与NodeJS配合使用。 You cannot load casper by using require('casperjs') in node. 您不能通过在节点中使用require('casperjs')来加载Casper。 Note that CasperJS is not capable of using a vast majority of NodeJS modules out there. 请注意,CasperJS无法使用其中的绝大多数NodeJS模块。

For more details read this links from official documentation: 有关更多详细信息,请阅读官方文档中的以下链接:

Installing from npm 从npm安装

Is CasperJS a node.js library? CasperJS是node.js库吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM