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

npm install fails with husky: command not found #1911

Closed
hwride opened this issue Feb 11, 2021 · 11 comments · Fixed by #1912
Closed

npm install fails with husky: command not found #1911

hwride opened this issue Feb 11, 2021 · 11 comments · Fixed by #1912
Assignees

Comments

@hwride
Copy link

hwride commented Feb 11, 2021

Q&A (please complete the following information)

  • OS: macOS Catalina v10.15.7
  • Environment: npm v6.14.10
  • Method of installation: npm
  • Swagger-Client version: 3.13.0
  • Swagger/OpenAPI version:

Content & configuration

A blank folder with an empty package.json.

Describe the bug you're encountering

When running npm i swagger-ui-react it fails when trying to perform the postinstall for swagger-client.

To reproduce...

Steps to reproduce the behavior:

  1. Create a folder with a new package.json file.
  2. Run npm i swagger-ui-react

Expected behavior

swagger-ui-react installs successfully.

Actual behaviour

$ npm i swagger-ui-react
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> [email protected] postinstall /Users/aaa/repos/node-test/test/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall /Users/aaa/repos/node-test/test/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall /Users/aaa/repos/node-test/test/node_modules/swagger-client
> husky install

sh: husky: command not found
npm WARN [email protected] requires a peer of react@>=15.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@>=15.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.3.0 || ^16.0.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0-0 || ^15.4.0-0 || ^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^0.14.9 || ^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>= 0.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>= 15 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@>= 15 but none is installed. You must install peer dependencies yourself.
npm WARN test No description
npm WARN test No repository field.
npm WARN test No license field.

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] postinstall: `husky install`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aaa/.npm/_logs/2021-02-11T14_31_34_996Z-debug.log
@xakraz
Copy link

xakraz commented Feb 11, 2021

Same here

@aldokkani
Copy link

same issue

@guy-mev
Copy link

guy-mev commented Feb 11, 2021

Same here, running on bitbucket pipelines with node:10.16

@gerardobort
Copy link

same issue

@gerardobort
Copy link

Hi all, the problem seems to be that husky is set as dev dependency, but required in post install script. When the install is done with --only=production, the problem occurs.

@char0n char0n self-assigned this Feb 11, 2021
@char0n
Copy link
Member

char0n commented Feb 11, 2021

On it, thanks for reporting this.

@char0n
Copy link
Member

char0n commented Feb 11, 2021

if your package is not private and you're publishing it on a registry like npmjs.com, you need to disable postinstall script using pinst. Otherwise, postinstall will run when someone installs your package and result in an error.

char0n added a commit that referenced this issue Feb 11, 2021
char0n added a commit that referenced this issue Feb 11, 2021
@char0n char0n reopened this Feb 11, 2021
@char0n
Copy link
Member

char0n commented Feb 11, 2021

Fix is in master, going for a patch release

@char0n
Copy link
Member

char0n commented Feb 11, 2021

char0n@mortality-ntb:/tmp $ npm i [email protected]

> [email protected] postinstall /tmp/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm WARN saveError ENOENT: no such file or directory, open '/tmp/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.

+ [email protected]
added 31 packages from 46 contributors and audited 31 packages in 8.296s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

@char0n char0n closed this as completed Feb 11, 2021
@hwride
Copy link
Author

hwride commented Feb 11, 2021

swagger-client install works for me also. What a quick response, thanks a lot!

@gerardobort
Copy link

Thank you @char0n for the quick response! and everyone here for reporting as well.

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

Successfully merging a pull request may close this issue.

6 participants