Nightmare JS not working

て烟熏妆下的殇ゞ 提交于 2019-12-01 18:01:44

New version of Nightmare requires electron, Not PhantomsJs. Make sure electron command is in your $PATH variable.

Install Electron

npm i -g electron-prebuilt

To debug:

DEBUG=nightmare* node script.js

Look at this Dockerfile: https://github.com/aheuermann/docker-electron/blob/master/7/Dockerfile

It s the minimal libs you need. And to start you script:

Xvfb -ac -screen scrn 1280x2000x24 :9.0 &
export DISPLAY=:9.0
DEBUG=* node src/index.js

Electron based app should no more crash

You can also try to set electron in the background without actually showing any GUI. You check if this works:

var nightmare = Nightmare({ show: false});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!