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

[Bug]: Husky error occurs when installing package via npm i into a project #310

Closed
3 tasks done
OtherLeadingBrand opened this issue Nov 28, 2022 · 2 comments · Fixed by #313
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@OtherLeadingBrand
Copy link

OtherLeadingBrand commented Nov 28, 2022

Before submitting...

Context

When installing 1.2.0 version of materializecss into our project via npm i an issue occurs.

This does not occur when installing version 1.1.0.

Current Behavior

npm ERR! code 1
npm ERR! path [redacted]\node_modules\@materializecss\materialize
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c husky install
npm ERR! 'husky' is not recognized as an internal or external command,
npm ERR! operable program or batch file.

Expected behavior

Expected the npm i command to complete without an error.

Possible Solutions or Causes

Husky is included under devDependencies in package.json but is being ran as a postinstall script by the end user.

According to the Husky docs, you cannot include husky install as a postinstall without using pinst. I am not sure if this is the root cause or not, but wanted to bring this to your attention:

https://typicode.github.io/husky/#/?id=yarn-2

image

I assume since husky is a dev dependency, you never intended for your end users to run the postinstall script.

Steps to reproduce

  1. Create a project that references @materializecss/materialize in its package.json.
  2. npm i to install the packages
  3. Note the error message.

Your Environment

  • Version used: 1.2.0
  • Browser Name and version: N/A
  • Operating System and version (desktop or mobile): Windows 10 Desktop
  • Additional information you want to tell us:
@OtherLeadingBrand OtherLeadingBrand added the bug Something isn't working label Nov 28, 2022
@OtherLeadingBrand OtherLeadingBrand changed the title [Bug]: [Bug]: Husky error occurs when installing package via npm i into a project Nov 28, 2022
@OtherLeadingBrand OtherLeadingBrand changed the title [Bug]: Husky error occurs when installing package via npm i into a project [Bug] [build]: Husky error occurs when installing package via npm i into a project Nov 28, 2022
@OtherLeadingBrand OtherLeadingBrand changed the title [Bug] [build]: Husky error occurs when installing package via npm i into a project [Bug]: Husky error occurs when installing package via npm i into a project Nov 28, 2022
@wuda-io
Copy link
Member

wuda-io commented Nov 28, 2022

Ah ok, i will look into this in detail.
Thanks for the detailed review.

I really dont know the mechanics of postinstall in detail, I found a tutorial online and it worked from there, maybe we can remove the postinstall command without damaging the functionality.

@OtherLeadingBrand
Copy link
Author

Understood, I have no previous experience either.

I hope this helps:
https://typicode.github.io/husky/#/?id=yarn-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants