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.

Pre-commit hook fails because it can't find lint-staged

See original GitHub issue

Describe the bug

image Pre-commit hook fails when I try to commit using GitHub Desktop.

Following is an excerpt of my package.json file

 "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": "npm run lint"
  }

This works when trying to commit using the command line and when tried using VSCode’s Git integration, but fails on GitHub Desktop. lint-stage is installed locally and I prefer to keep it that way.

Version & OS

Version 2.6.3 Windows 10 Home

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ruggi99commented, Aug 3, 2021

I uninstalled nvm, reinstalled node, restarted Windows and it didn’t worked. So I reinstalled GitHub Desktop and doesn’t work again. But in any other terminal I can commit with pre-commit

0reactions
benson00077commented, Jul 21, 2022

Same issue here, with same package.json config + nvm. Git command line works well but but with GitHub Desktop doesn’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

lint-staged not running on precommit - Stack Overflow
The way I found out it was a problem with husky and npm was because I found out that I had no pre-commit...
Read more >
Getting started with Husky and Lint-staged for pre-commit hooks
The command eslint will lint the specified staged file and show any errors if the linting fails. It may seem odd that there...
Read more >
Commit hooks are skipped due to PATH issues - Jira - Atlassian
At first I thought it's a problem with lint-staged or husky but ... We get many commits that fail in CI that should...
Read more >
Using lint-staged, husky, and pre-commit hooks to fail fast and ...
Pre -commit checks are commonly used to run linting scripts and tests, allowing each commit to be as clean as possible. As the...
Read more >
Diving into Husky and Lint-staged | Laurie on Tech
The commands you configure will run "pre-commit". As you're attempting to commit files to your project you'll see ESLint run in your terminal....
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