question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: NPM Error on failing test executed from NPM script

See original GitHub issue

Context:

  • Playwright Version: 1.17.1
  • Operating System: Windows
  • Node.js version: 14.18.2
  • Browser: Chromium

Describe the bug I used to run my tests using NPM script defined in my package.json:

"scripts": {
   "test:ci": "npx playwright test"
}

Running a failing test from NPM script ends with NPM Error:

npm run test:ci

ends with:

2021-12-05T13:02:03.7715503Z npm ERR! code ELIFECYCLE
2021-12-05T13:02:03.7918485Z npm ERR! errno 1
2021-12-05T13:02:03.7919057Z 
2021-12-05T13:02:03.8067720Z npm ERR! e2e@2022.1.4 test:ci: `npx playwright test`
2021-12-05T13:02:03.8070810Z 
2021-12-05T13:02:03.8280569Z npm ERR! Exit status 1
2021-12-05T13:02:03.8281096Z 
2021-12-05T13:02:03.8432967Z npm ERR! 
2021-12-05T13:02:03.8433432Z 
2021-12-05T13:02:03.8584075Z npm ERR! Failed at the e2e@2022.1.4 test:ci script.
2021-12-05T13:02:03.8584788Z 
2021-12-05T13:02:03.8749940Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-05T13:02:03.9048161Z npm ERR! A complete log of this run can be found in:
2021-12-05T13:02:03.9048422Z 
2021-12-05T13:02:03.9196592Z npm ERR!     C:\Users\TestAdmin\AppData\Roaming\npm-cache\_logs\2021-12-05T13_01_56_278Z-debug.log

And here is the NPM log file 2021-12-05T13_01_56_278Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test:ci'
1 verbose cli ]
2 info using npm@6.14.15
3 info using node@v14.18.2
4 verbose run-script [ 'pretest:ci', 'test:ci', 'posttest:ci' ]
5 info lifecycle e2e@2022.1.4~pretest:ci: e2e@2022.1.4
6 info lifecycle e2e@2022.1.4~test:ci: e2e@2022.1.4
7 verbose lifecycle e2e@2022.1.4~test:ci: unsafe-perm in lifecycle true
8 verbose lifecycle e2e@2022.1.4~test:ci: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Tests\WZC_Tests\Playwright\node_modules\.bin;C:\Program Files (x86)\KMD\WorkZone\Oracle;C:\Program Files (x86)\KMD\WorkZone\program;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\Users\TestAdmin\AppData\Local\Microsoft\WindowsApps;C:\Users\TestAdmin\AppData\Roaming\npm
9 verbose lifecycle e2e@2022.1.4~test:ci: CWD: C:\Tests\WZC_Tests\Playwright
10 silly lifecycle e2e@2022.1.4~test:ci: Args: [ '/d /s /c', 'npx playwright test' ]
11 silly lifecycle e2e@2022.1.4~test:ci: Returned: code: 1  signal: null
12 info lifecycle e2e@2022.1.4~test:ci: Failed to exec test:ci script
13 verbose stack Error: e2e@2022.1.4 test:ci: `npx playwright test`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:400:28)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:400:28)
13 verbose stack     at maybeClose (internal/child_process.js:1058:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
14 verbose pkgid e2e@2022.1.4
15 verbose cwd C:\Tests\WZC_Tests\Playwright
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:ci"
18 verbose node v14.18.2
19 verbose npm  v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error e2e@2022.1.4 test:ci: `npx playwright test`
22 error Exit status 1
23 error Failed at the e2e@2022.1.4 test:ci script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
creagecommented, Dec 7, 2021

https://github.com/facebook/jest/issues/7803 Sounds similar, right?)

I’ll give a try to suggested approach from there, and get back later.

0reactions
creagecommented, Dec 11, 2021

Well, let’s close it as designed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - npm run always gives error when trying to run scripts
This is normal, when you run npm run test , it will execute the corresponding script in package.json , so this line "test":...
Read more >
ts-node - npm
This error is thrown by node when a module is require() d, but node believes it should execute as native ESM. This can...
Read more >
start-server-and-test - npm
This command is meant to be used with NPM script commands. If you have a "start server", and "test" script names for example,...
Read more >
npm-run-script
If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run...
Read more >
Common errors | npm Docs
Random errors · Some strange issues can be resolved by simply running npm cache clean and trying again. · If you are having...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found