husky icon indicating copy to clipboard operation
husky copied to clipboard

`husky.sh` file generated by `husky install` becomes empty

Open JairTorres1003 opened this issue 9 months ago • 2 comments

Troubleshoot

  • [X] Before creating an issue, please check: https://typicode.github.io/husky/troubleshoot.html

If you're migrating from husky 4, see: https://typicode.github.io/husky/migrate-from-v4.html

Context

Problem: When running npx husky install or npm run prepare, the husky.sh file within .husky/_ directory is left empty, causing hooks configured in the .husky directory to not function properly.

This is my package.json

{
  "version": "0.1.0",
  "private": true,
  "license": "MIT",
  "engines": {
    "node": ">=20.10.0"
  },
  "scripts": {
    "dev": "next dev",
    "build": "next build --no-lint",
    "start": "next start",
    "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
    "lint:fix": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix --cache",
    "format:check": "prettier --check \"**/*.{ts,tsx,json,css,md,cjs}\"",
    "format": "prettier --write \"**/*.{ts,tsx,json,css,md,cjs}\"",
    "prepare": "husky install"
  },
  "dependencies": {
    "@emotion/react": "^11.11.3",
    "@emotion/styled": "^11.11.0",
    "@fullcalendar/core": "^6.1.11",
    "@fullcalendar/react": "^6.1.11",
    "@fullcalendar/timegrid": "^6.1.11",
    "@mercadopago/sdk-react": "^0.0.18",
    "@mui/icons-material": "^5.15.10",
    "@mui/material": "^5.15.9",
    "@mui/x-date-pickers": "^7.1.1",
    "@reduxjs/toolkit": "^2.1.0",
    "@tiptap/extension-color": "^2.3.0",
    "@tiptap/extension-text-style": "^2.3.0",
    "@tiptap/pm": "^2.3.0",
    "@tiptap/react": "^2.3.0",
    "@tiptap/starter-kit": "^2.3.0",
    "axios": "^1.6.7",
    "dayjs": "^1.11.10",
    "leaflet": "^1.9.4",
    "localforage": "^1.10.0",
    "next": "14.1.1",
    "react": "^18",
    "react-dom": "^18",
    "react-google-recaptcha": "^3.1.0",
    "react-hook-form": "^7.50.1",
    "react-leaflet": "^4.2.1",
    "react-player": "^2.15.1",
    "react-redux": "^9.1.0",
    "react-responsive": "^10.0.0",
    "react-to-print": "^2.15.1",
    "redux-persist": "^6.0.0",
    "swiper": "^11.0.6",
    "universal-cookie": "^7.1.4",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@types/leaflet": "^1.9.8",
    "@types/node": "^20.11.16",
    "@types/react": "^18.2.55",
    "@types/react-dom": "^18.2.19",
    "@types/react-google-recaptcha": "^2.1.9",
    "@typescript-eslint/eslint-plugin": "^7.5.0",
    "@typescript-eslint/parser": "^7.5.0",
    "eslint": "^8.56.0",
    "eslint-config-love": "^46.0.0",
    "eslint-config-next": "^14.1.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-config-standard": "^17.1.0",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.5",
    "husky": "^9.0.11",
    "lint-staged": "^15.2.2",
    "prettier": "^3.2.5",
    "typescript": "^5.3.3"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{ts,tsx}": "eslint --cache --fix",
    "*.{ts,tsx,css,md,json}": "prettier --write"
  }
}

Steps to Reproduce: Run npx husky install or npm run prepare to generate Husky configuration files. Check the contents of the husky.sh file within the .husky/_ directory.

  • Terminal or GUI client: Git Bash, GitHub Desktop, VSCode

JairTorres1003 avatar May 14 '24 15:05 JairTorres1003