gpt4 book ai didi

node.js - Vagrant 上的nightmareJS超时

转载 作者:行者123 更新时间:2023-12-03 13:24:00 25 4
gpt4 key购买 nike

我有无所事事的虚拟机,我可以从那里访问某些端点(通过curl)。我安装了 Node (v 8.4.0)和npm(v 5.3.0)。我通过sudo运行它。我使用nightmareJS,它无法连接到端点。我在另一台机器上运行相同的测试用例,它可以正常工作而不会超时:

测试/test_simple.js

const Nightmare = require('nightmare')

describe('UI Flow Tests', function() {
this.timeout('60s')

let nightmare = null
beforeEach(() => {
nightmare = new Nightmare()
})



describe('Using the App', function () {
describe('customize', () => {
it('should work without timing out', done => {
nightmare
.goto('http://simple-form-bootstrap.plataformatec.com.br/documentation')
.end()
.then(result => { done() })
.catch(done)
})
})
})
})

当我运行时:
sudo npm test

然后有一个超时:
> codec@1.0.0 test /home/vagrant/project/codecept
> mocha



UI Flow Tests
Using the App
customize
1) should work without timing out


0 passing (1m)
1 failing

1) UI Flow Tests Using the App customize should work without timing out:
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.




npm ERR! Test failed. See above for more details.

编辑

我尝试了 Node v8.3.0和 Nightmare 2.8和2.4.1,但存在相同的错误。看起来 Vagrant 正在阻止请求(?)

编辑2
我在调试 Node 上遇到了 Nightmare ,但遇到电子错误: DEBUG=nightmare npm test
nightmare electron child process exited with code 127: command not found - you may not have electron installed correctly +0ms
nightmare queueing action "goto" for http://simple-form-bootstrap.plataformatec.com.br/documentation +3ms
nightmare running +2ms

编辑3
deguggin电子给出:
electron:stderr /home/vagrant/te/node_modules/electron/dist/electron: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

最佳答案

我必须安装libxss1 libnspr4-0d libcurl3,libx11-xcb-dev。也许并非所有库都是必需的。

关于node.js - Vagrant 上的nightmareJS超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46057519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com