start-server-and-test
start-server-and-test copied to clipboard
Error: kill EPERM
Bug
There seems to have been a change in node > 20 that is causing start-server-and-test to error due to child processes (cypress + electron) closing.
Child process 24584 exited before trying to stop it
Error: kill EPERM
at process.kill (node:internal/process/per_thread:228:13)
at D:\testing\vue-project\node_modules\start-server-and-test\src\index.js:62:23
at Array.forEach (<anonymous>)
at D:\testing\vue-project\node_modules\start-server-and-test\src\index.js:60:20
at tryCatcher (D:\testing\vue-project\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:673:18)
at D:\testing\vue-project\node_modules\bluebird\js\release\nodeback.js:42:21
at D:\testing\vue-project\node_modules\ps-tree\index.js:87:7
at a.end (D:\testing\vue-project\node_modules\event-stream\index.js:87:5)
at Stream.onend (node:internal/streams/legacy:48:10)
at Stream.emit (node:events:531:35)
at end (D:\testing\vue-project\node_modules\map-stream\index.js:116:39) {
errno: -4048,
code: 'EPERM',
syscall: 'kill'
}
I'm not sure what the root cause is, or even which library is causing the error. But as the overall runner, it seems like its start-server-and-test not liking child processes closing or closing in an irregular way.
Reproduce - leverage vue to create a project scaffold of start-server-and-test + server + cypress runner:
- npm create vue@latest
- No for everything - choose cypress.
- npm install
- npm run build
- npm run test:e2e
run the test:e2e a few times as it can be a race-condition.
shell: windows 11, cmd or ps
node -v : 21.7.3 and 22.3.0
npm why start-server-and-test : [email protected]
npm why cypress: [email protected]
This specifically seems to be an issue on node > 20, as in node 20 you only get the messages "Child process [number] exited before trying to stop it", but it doesn't Error.
If you swap out vite for http-server ( "preview": "http-server ./dist -p 4173", ) you still get the Error: kill EPERM.
If you remove start-server-and-test, add and run "cypress": "cypress run --e2e",
along with separate term for preview
it exits without error.