最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to resolve the error "ERR! code ELIFECYCLE"? - Stack Overflow

programmeradmin2浏览0评论

I am using the Jest to perform the unit testing.

"jest": "^26.4.2",
"jest-preset-angular": "^8.3.1"

All the test has been passed and ran but got an error as below

Test Suites: 20 passed, 20 total
Tests:       26 passed, 26 total
Snapshots:   2 obsolete, 5 passed, 5 total
Time:        92.961 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test:app script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete log of this run can be found in:
npm ERR!     /Users/macbook/.npm/_logs/2020-09-15T09_19_42_790Z-debug.log

I tried the below mand from the google search, however, it is not working

npm cache clean --force

rm -rf node_modules

npm install

error from logs

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test:app' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest:app', 'test:app', 'posttest:app' ]
5 info lifecycle [email protected]~pretest:app: [email protected]
6 info lifecycle [email protected]~test:app: [email protected]
7 verbose lifecycle [email protected]~test:app: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test:app: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/.bin:/usr/local/opt/helm@2/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
9 verbose lifecycle [email protected]~test:app: CWD: /Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp
10 silly lifecycle [email protected]~test:app: Args: [ '-c', 'jest --config ./jest.app.config.js --no-cache' ]
11 silly lifecycle [email protected]~test:app: Returned: code: 1  signal: null
12 info lifecycle [email protected]~test:app: Failed to exec test:app script
13 verbose stack Error: [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:app"
18 verbose node v14.5.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
22 error Exit status 1
23 error Failed at the [email protected] test:app script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I am using the Jest to perform the unit testing.

"jest": "^26.4.2",
"jest-preset-angular": "^8.3.1"

All the test has been passed and ran but got an error as below

Test Suites: 20 passed, 20 total
Tests:       26 passed, 26 total
Snapshots:   2 obsolete, 5 passed, 5 total
Time:        92.961 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test:app script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete log of this run can be found in:
npm ERR!     /Users/macbook/.npm/_logs/2020-09-15T09_19_42_790Z-debug.log

I tried the below mand from the google search, however, it is not working

npm cache clean --force

rm -rf node_modules

npm install

error from logs

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test:app' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest:app', 'test:app', 'posttest:app' ]
5 info lifecycle [email protected]~pretest:app: [email protected]
6 info lifecycle [email protected]~test:app: [email protected]
7 verbose lifecycle [email protected]~test:app: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test:app: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/.bin:/usr/local/opt/helm@2/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
9 verbose lifecycle [email protected]~test:app: CWD: /Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp
10 silly lifecycle [email protected]~test:app: Args: [ '-c', 'jest --config ./jest.app.config.js --no-cache' ]
11 silly lifecycle [email protected]~test:app: Returned: code: 1  signal: null
12 info lifecycle [email protected]~test:app: Failed to exec test:app script
13 verbose stack Error: [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:app"
18 verbose node v14.5.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
22 error Exit status 1
23 error Failed at the [email protected] test:app script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Share Improve this question edited Dec 29, 2020 at 15:14 Flip 6,8018 gold badges52 silver badges83 bronze badges asked Sep 15, 2020 at 9:27 San JaisySan Jaisy 17.2k43 gold badges206 silver badges348 bronze badges 7
  • check what logs are present in /Users/macbook/.npm/_logs/2020-09-15T09_19_42_790Z-debug.log – r7r Commented Sep 15, 2020 at 9:48
  • Is this the whole output? Usually there's a better error message above your test summary. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. – user5426760 Commented Sep 15, 2020 at 9:48
  • @Helvetios - added logs from the file – San Jaisy Commented Sep 15, 2020 at 9:52
  • @SanJaisy Could you include the whole console output as well, not just eh debug log? As you can see here: stackoverflow./questions/46756406/… there's probably a better error message in the console above the test summary – user5426760 Commented Sep 15, 2020 at 10:00
  • @Helvetios How can I do that, I am not sure how can I achieve that as you have mention – San Jaisy Commented Sep 15, 2020 at 10:05
 |  Show 2 more ments

3 Answers 3

Reset to default 1
Snapshots: 2 obsolete, 5 passed, 5 total

obsolete - are the cause of the error, after their removal, the error is gone.

Delete the snapshots and rerun the test everything should work fine

Reference - https://github./facebook/jest/issues/9324

I faced the similar issue in wdio cucumber setup with node 14, and npm 6. The tests were executed correctly but this error surfaced in every run.

error code ELIFECYCLE 
error Exit status 1

upgraded to the latest node 16.17.0 and npm 8.18 -- error gone. The error could be due to non patible packages

I tried to solve this problem with this way:

rm -rf node_modules && rm ./package-lock.json && npm install

After that restart your machine and its working perfectly.

发布评论

评论列表(0)

  1. 暂无评论