Cypress exits with "npm ERR! code ELIFECYCLE" after headless run
See original GitHub issueI have a list of scripts:
When I run npm run cy:test
and during this run I have one of the tests failed, my npm script exits with this error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! integration-tests@1.0.0 cy:test: `npm run prereport && npx cypress run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the integration-tests@1.0.0 cy:test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yural\AppData\Roaming\npm-cache\_logs\2021-06-11T13_10_32_602Z-debug.log
Screenshot of the run with failed test:
Screenshot of the run with successful test:
In both cases prereport
script will have its job done (erases result folder) and cypress run
will execute all specs, however if during the run some tests failed it will exist with NPM error. I would not mind that in this case, because I have all my scripts done despite that error. HOWEVER, I also have another script which is called cy:run
, in this case I want my mochawesome reports be generated in the end of the run, BUT if, again, one of the tests failed during the run npm
WON’T run my junit:mr
and mocha:mr
. ALSO want to mention that if I run npx cypress run ALONE, it will exit without any NPM error in the end even with having all tests failed.
Here is my log of the error with npm run cy:test
:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'D:\\Programs\\Nodejs\\node.exe',
1 verbose cli 'D:\\Programs\\Nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'cy:test'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.4
4 verbose run-script [ 'precy:test', 'cy:test', 'postcy:test' ]
5 info lifecycle integration-tests@1.0.0~precy:test: integration-tests@1.0.0
6 info lifecycle integration-tests@1.0.0~cy:test: integration-tests@1.0.0
7 verbose lifecycle integration-tests@1.0.0~cy:test: unsafe-perm in lifecycle true
8 verbose lifecycle integration-tests@1.0.0~cy:test: PATH: D:\Programs\Nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Programs\OpenServer\OpenServer\domains\dipp\integration-tests\node_modules\.bin;D:\Programs\Git\mingw64\bin;D:\Programs\Git\usr\bin;C:\Users\yural\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\IBM\SPSS\Statistics\23\JRE\bin;C:\Program Files (x86)\QuickTime\QTSystem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D:\Programs\codeopenio\command;D:\Programs\Git\cmd;C:\Program Files\dotnet;D:\Programs\Nodejs;C:\Program Files\Calibre2;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\yural\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\yural\AppData\Local\Programs\Python\Python38-32;C:\Users\yural\AppData\Local\Microsoft\WindowsApps;D:\Programs\Microsoft VS Code\bin;C:\Users\yural\AppData\Roaming\npm
9 verbose lifecycle integration-tests@1.0.0~cy:test: CWD: D:\Programs\OpenServer\OpenServer\domains\dipp\integration-tests
10 silly lifecycle integration-tests@1.0.0~cy:test: Args: [ '/d /s /c', 'npm run prereport && npx cypress run' ]
11 silly lifecycle integration-tests@1.0.0~cy:test: Returned: code: 1 signal: null
12 info lifecycle integration-tests@1.0.0~cy:test: Failed to exec cy:test script
13 verbose stack Error: integration-tests@1.0.0 cy:test: `npm run prereport && npx cypress run`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (D:\Programs\Nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (D:\Programs\Nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid integration-tests@1.0.0
15 verbose cwd D:\Programs\OpenServer\OpenServer\domains\dipp\integration-tests
16 verbose Windows_NT 10.0.19043
17 verbose argv "D:\\Programs\\Nodejs\\node.exe" "D:\\Programs\\Nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "cy:test"
18 verbose node v12.18.4
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error integration-tests@1.0.0 cy:test: `npm run prereport && npx cypress run`
22 error Exit status 1
23 error Failed at the integration-tests@1.0.0 cy:test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
P.S. I have tried to clear npm cache, delete node_modules, delete lock.json file and run npm i command dozens of times, I even tried different cypress versions and other related plugins and packages, reboot my PC and all magic I had, ZERO result.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
@yasinitskyi I see that you closed this issue. I am also facing the same issue. Were you able to find the root cause and a solution?
o erro persiste, alguma solução ?