Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The file in the staging area is lost due to an error #1129

Closed
psrx opened this issue Apr 2, 2022 · 12 comments
Closed

The file in the staging area is lost due to an error #1129

psrx opened this issue Apr 2, 2022 · 12 comments

Comments

@psrx
Copy link

psrx commented Apr 2, 2022

NodeJS: v16.14.2

package.json

{
  "name": "uni-preset-vue",
  "version": "0.0.0",
  "scripts": {
    "dev": "uni --open",
    "dev:app": "uni -p app",
    "dev:custom": "uni -p",
    "dev:h5": "uni",
    "dev:h5:ssr": "uni --ssr",
    "dev:mp-alipay": "uni -p mp-alipay",
    "dev:mp-baidu": "uni -p mp-baidu",
    "dev:mp-kuaishou": "uni -p mp-kuaishou",
    "dev:mp-lark": "uni -p mp-lark",
    "dev:mp-qq": "uni -p mp-qq",
    "dev:mp-toutiao": "uni -p mp-toutiao",
    "dev:mp-weixin": "uni -p mp-weixin",
    "dev:quickapp-webview": "uni -p quickapp-webview",
    "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
    "dev:quickapp-webview-union": "uni -p quickapp-webview-union",
    "build:app": "uni build -p app",
    "build:custom": "uni build -p",
    "build:h5": "uni build",
    "build:h5:ssr": "uni build --ssr",
    "build:mp-alipay": "uni build -p mp-alipay",
    "build:mp-baidu": "uni build -p mp-baidu",
    "build:mp-kuaishou": "uni build -p mp-kuaishou",
    "build:mp-lark": "uni build -p mp-lark",
    "build:mp-qq": "uni build -p mp-qq",
    "build:mp-toutiao": "uni build -p mp-toutiao",
    "build:mp-weixin": "uni build -p mp-weixin",
    "build:quickapp-webview": "uni build -p quickapp-webview",
    "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
    "build:quickapp-webview-union": "uni build -p quickapp-webview-union",
    "prepare": "husky install"
  },
  "dependencies": {
    "@dcloudio/uni-app": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-app-plus": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-components": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-h5": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-alipay": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-baidu": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-kuaishou": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-lark": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-qq": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-toutiao": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-mp-weixin": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-quickapp-webview": "^3.0.0-alpha-3040320220325006",
    "luch-request": "^3.0.7",
    "pinia": "^2.0.13",
    "vue": "^3.2.31",
    "vue-request": "^1.2.4"
  },
  "devDependencies": {
    "@dcloudio/types": "^2.5.19",
    "@dcloudio/uni-automator": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/uni-cli-shared": "^3.0.0-alpha-3040320220325006",
    "@dcloudio/vite-plugin-uni": "^3.0.0-alpha-3040320220325006",
    "@typescript-eslint/eslint-plugin": "^5.17.0",
    "@typescript-eslint/parser": "^5.17.0",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-config-standard": "^16.0.3",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^5.2.0",
    "eslint-plugin-vue": "^8.5.0",
    "husky": "^7.0.4",
    "postcss": "^8.4.12",
    "postcss-html": "^1.3.0",
    "postcss-scss": "^4.0.3",
    "prettier": "^2.6.1",
    "sass": "^1.49.10",
    "stylelint": "^14.6.1",
    "stylelint-config-prettier-scss": "^0.0.1",
    "stylelint-config-recess-order": "^3.0.0",
    "stylelint-config-recommended-vue": "^1.4.0",
    "stylelint-config-standard-scss": "^3.0.0",
    "stylelint-csstree-validator": "^2.0.0",
    "stylelint-declaration-block-no-ignored-properties": "^2.5.0",
    "stylelint-group-selectors": "^1.0.8",
    "typescript": "^4.6.3",
    "unplugin-auto-import": "^0.6.9",
    "unplugin-vue-components": "^0.18.5",
    "vite": "^2.9.1",
    "vue-demi": "^0.12.5"
  },
  "lint-staged": {
    "*.{js,ts,vue}": "eslint --fix",
    "*.{css,scss,sass,vue}": "stylelint --fix",
    "*.{js,ts,md,vue}": "prettier --write"
  }
}

ERROR:
node:internal/errors:464 ErrorCaptureStackTrace(err); ^
Error: kill ENOSYS at kill (node:internal/process/per_thread:220:13) at Arra

I'm sorry I can't provide a complete log for the time being
I can only provide some information based on the search records

Because it doesn't happen 100%
When I tried the second time, I succeeded
I only remember that I restored sass version 1.49.11 - > 1.49.10

I used pnpm and I'm not sure if it's relevant
Because the error message contains node_ modules

If I find it next time, I will provide a complete log

@rexkenley
Copy link

rexkenley commented Apr 6, 2022

I have the same exact issue.

node 16.14.2
lint-staged 12.3.7

[2022-04-06T20:48:11.949Z] [STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] .lintstagedrc.json�[2m — 1 file�[22m
[STARTED] .{js,jsx}�[2m — 0 file�[22m
[STARTED] src/**/
.{ts,tsx}�[2m — 1 file�[22m
[STARTED] stories//*.{ts,tsx}�[2m — 0 file�[22m
[STARTED] *�[2m — 1 file�[22m
[SKIPPED] *.{js,jsx}�[2m — no files�[22m
[SKIPPED] stories/
/*.{ts,tsx}�[2m — no files�[22m
[STARTED] tsc-files
[STARTED] npm run-script prettier:format
[FAILED] �[91mtsc-files�[39m �[2m[FAILED]�[22m
[FAILED] �[91mtsc-files�[39m �[2m[FAILED]�[22m
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
node:internal/errors:464
ErrorCaptureStackTrace(err);
^

Error: kill ENOSYS
at kill (node:internal/process/per_thread:220:13)
at Array.forEach ()
at Timeout.loop [as _onTimeout] (file:///C:/vs/GIT/PowerFramework360/node_modules/lint-staged/lib/resolveTaskFn.js:62:11) {
errno: -4054,
code: 'ENOSYS',
syscall: 'kill'
}
husky - pre-commit hook exited with code 1 (error)

I reverted back to 12.3.4 and that still works.

@kling90
Copy link

kling90 commented Apr 7, 2022

I almost lost a couple of hours work because of a similar error.

Upgraded to version 12.3.7 this morning and when I was going to commit changes it errored and my changes were gone.
The first time I was able to use the stash backup to restore my changes but the second time the git process crashed and I was unable to pop the stash.
Luckily I had made a copy of my changes outside the repository.

OS Windows 10
node 16.14.0
lint-staged 12.3.7

[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json�[2m — 20 files�[22m
[STARTED] *.(js|svelte)�[2m — 17 files�[22m
[STARTED] *.(scss|css|svelte)�[2m — 9 files�[22m
[STARTED] *.(svelte)�[2m — 9 files�[22m
[STARTED] eslint
[STARTED] stylelint
[STARTED] prettier --check
[FAILED] �[91mprettier --check�[39m �[2m[FAILED]�[22m
[FAILED] �[91mprettier --check�[39m �[2m[FAILED]�[22m
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
[FAILED] �[91meslint�[39m �[2m[FAILED]�[22m
[FAILED] �[91meslint�[39m �[2m[FAILED]�[22m
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error: kill ESRCH
    at kill (node:internal/process/per_thread:220:13)
    at Array.forEach (<anonymous>)
    at Timeout.loop (file:///C:/dev/skalbar-2/node_modules/lint-staged/lib/resolveTaskFn.js:62:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4040,
  code: 'ESRCH',
  syscall: 'kill'
}
husky - pre-commit hook exited with code 1 (error)

I reverted back to 12.3.4 as @rexkenley suggested and now it works as expected.

@jimvanasperen
Copy link

This PR that was introduced in 12.3.6 seems a likely cause: #1117.
I think it may kill the revert process losing the files.

As stated above, try git stash list and git stash pop for backed up files.

@jroberati
Copy link

Chiming in to say that we've run into this issue and it seems specific to Windows. 12.3.7 works fine on my setup (OSX), but our other dev experienced errors when trying to restore the stash on Windows. Reverting to 12.3.4 worked.

Relevant logs with --debug

[STARTED] prettier --check
[FAILED] prettier --check [FAILED]
[FAILED] prettier --check [FAILED]
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
  lint-staged:GitWorkflow Restoring original state... +381ms
  lint-staged:execGit Running git command [ 'reset', '--hard', 'HEAD' ] +452ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +102ms
  lint-staged:execGit Running git command [ 'stash', 'apply', '--quiet', '--index', 'refs/stash@{0}' ] +105ms
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^
Error: kill ENOSYS
    at kill (node:internal/process/per_thread:215:13)
    at Array.forEach (<anonymous>)
    at Timeout.loop [as _onTimeout] (file:///C:/XXXXXXXX/AppData/Local/npm-cache/_npx/8facc973fbdb1091/node_modules/lint-staged/lib/resolveTaskFn.js:62:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4054,
  code: 'ENOSYS',
  syscall: 'kill'
}

@stef7
Copy link

stef7 commented Apr 13, 2022

Can confirm this is happening on Windows...

[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...        
[STARTED] packages/components/package.json — 1 file
[STARTED] **/*.{js,ts,tsx} — 1 file
[STARTED] **/*.{ts,tsx} — 1 file
[STARTED] eslint --fix
[STARTED] tsc-files
[FAILED] tsc-files [FAILED]
[FAILED] tsc-files [FAILED]
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error: kill ENOSYS
    at kill (node:internal/process/per_thread:220:13)
    at Array.forEach (<anonymous>)
    at Timeout.loop [as _onTimeout] (file:///C:/work/[...]/node_modules/lint-staged/lib/resolveTaskFn.js:62:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4054,
  code: 'ENOSYS',
  syscall: 'kill'
}
husky - pre-commit hook exited with code 1 (error)

@zch233
Copy link

zch233 commented Apr 22, 2022

update version to 12.4.0

@mjlehrke
Copy link

Had this happen to me on 12.4.1

@NidusP
Copy link

NidusP commented Aug 8, 2022

i get 465

node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error: kill ESRCH
    at process.kill (node:internal/process/per_thread:220:13)
    at Timeout.loop (file:///D:/workspace_cli/vite-vue3-admin/node_modules/.pnpm/lint-staged@12.5.0/node_modules/lint-staged/lib/resolveTaskFn.js:67:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4040,
  code: 'ESRCH',
  syscall: 'kill'
}
husky - pre-commit hook exited with code 1 (error)

@iiroj
Copy link
Member

iiroj commented Aug 8, 2022

Have you updated to v13.0.1?

prevent possible race condition when killing tasks on failure (bc92aff)

@huangjihua
Copy link

$ lint-staged
node:internal/process/esm_loader:94
internalBinding('errors').triggerUncaughtException(
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/Users/huangjihua/github/ts-dom-to-image/node_modules/.pnpm/lint-staged@13.0.3/node_modules/lint-staged/node_modules/execa/' imported from /Users/huangjihua/github/ts-dom-to-image/node_modules/.pnpm/lint-staged@13.0.3/node_modules/lint-staged/lib/execGit.js
Did you mean to import execa@6.1.0/node_modules/execa/index.js?
at new NodeError (node:internal/errors:371:5)
at legacyMainResolve (node:internal/modules/esm/resolve:336:9)
at packageResolve (node:internal/modules/esm/resolve:917:14)
at moduleResolve (node:internal/modules/esm/resolve:976:18)
at defaultResolve (node:internal/modules/esm/resolve:1078:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
at ModuleWrap. (node:internal/modules/esm/module_job:79:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
error Command failed with exit code 1.

@AchyuthFireEye
Copy link

is it resolved ?

@iiroj
Copy link
Member

iiroj commented Nov 4, 2022

I believe the original issue is resolved, yet. I'll close this ticket for now.

@iiroj iiroj closed this as completed Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests