Skip to content

remove prepare script using husky and deprecated husky set from npm package #6931

@bahag-Rothm

Description

@bahag-Rothm

Describe the bug

Hi Axios contributors,

While installing axios@1.9.0 as a transitive dependency in a monorepo, I’m encountering this error:

npm error .git can't be found
npm error > axios@1.9.0 prepare:hooks
npm error > npx husky set .husky/commit-msg "npx commitlint --edit $1"
npm error husky - install command is DEPRECATED

This appears to be caused by a prepare script in package.json that looks like this:
"scripts": { "prepare": "husky install && npm run prepare:hooks", "prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"" }

This usage of husky in a published npm package breaks installation for consumers:
• It assumes a .git directory exists (which is not always true in monorepos or CI)
• It uses deprecated Husky commands (install, set)
• It runs developer-only tooling during install

Please consider removing the prepare script from the published package and move hook setup to a local-only husky:init script for contributors, e.g.:

"scripts": { "husky:init": "npx husky install && npx husky set .husky/commit-msg 'npx commitlint --edit $1'" }

To Reproduce

  1. go into a monorepo
  2. install a package that wants axios 1.9.0 as a resolution or dependencie

Code snippet

see above

Expected behavior

should install as a transitive dependency in a monorepo

Axios Version

1.9.0

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

Additional Library Versions

Additional context/Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions