How to use an external module in an electron

Asked 2 years ago, Updated 2 years ago, 157 views

I'm thinking of using casper.js in the electron.
In main.js

require('casper');

Write and run

Cannot find module 'casper'

will be displayed as .
Can't I use an external module with an electron?

Thank you for your cooperation.

javascript html5 node.js electron

2022-09-30 18:49

1 Answers

Hello, I don't think there was a response.

First, CasperJS is not a module of js.
Also, since the Electron is running on node.js, you must run an external command from node.js.However, if you look at npm, phantom.js has a module that says node-phantom.

So I checked the casperJS you asked me about this time and it seems that there is a SpookyJS.
https://github.com/SpookyJS/SpookyJS

I think I can do it here.

If it's an externally loaded method, I think it's better to call child_process and create an exec function.


2022-09-30 18:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.