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

npx husky install command not found #901

Closed
TerrySmithDC opened this issue Mar 9, 2021 · 6 comments
Closed

npx husky install command not found #901

TerrySmithDC opened this issue Mar 9, 2021 · 6 comments

Comments

@TerrySmithDC
Copy link

Hi there, I've always been a big fan of this project. Unfortunately I'm having some issues on one of my projects since upgrading to husky 5. Previously this was working using husky 5.1.3, however I cleared my npm cache today and now I'm unable to install or commit on the project.

I have read Troubleshooting: Command not found however this seems like a separate issue so I thought I'd make a ticket.

Info

  • Using Item2 / zsh
  • Recently cleared npm cache with npm cache clean --force
  • I've tried deleting node_modules and package-lock.json followed with npm install in various combinations.
  "scripts": {
    ....
    "postinstall": "husky install"
  },
    "devDependencies": {
    ...
    "husky": "^5.1.3",
  },

Error

➜ npm i
> project@0.1.0 postinstall
> husky install

sh: husky: command not found

I also tried npx husky install which I would have expected to work here. To check my npm/npx is ok I tested out npx serve . and it worked with no problems.

➜ npx husky install
sh: husky: command not found

This feels like a bug / maybe a missing bin file in the registry? Not sure... Any help would be appreciated.

@wolfmaster8
Copy link

We're having the same error. We're trying to install a RN dependency that has a postinstall script and it uses husky underneath.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-native-device-info@8.0.3 postinstall: `husky install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-native-device-info@8.0.3 postinstall script.

@typicode
Copy link
Owner

Hmm I can't seem to reproduce the error, sorry. I would have done the same, delete package-lock.json/node_modules and reinstall.

@wolfmaster8 it seems to have been fixed in 8.0.5

@anaetrezve
Copy link

anaetrezve commented Mar 16, 2021

Deleting node_modules and package-lock.json then running npm install fixed the issue for me.

@TerrySmithDC
Copy link
Author

Deleting node_modules and package-lock.json never did work for me.

However over the week end I ended up uninstalling nvm, got the same node/npm version, ran npm install and husky is back to working totally fine.

@bilal-younus
Copy link

Delete node_modules and package-lock.json never did work for me.
So i run these two commands and boom magic
npx husky-init && npm install
npm install husky --save-dev

npx husky install

Thanks me later.

@JairTorres1003
Copy link

I have a problem related to the husky install command since when said command is executed the .husky/_/husky.sh file is empty, which prevents it from working correctly.

I don't know if this has happened to anyone and they have already been able to find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants