mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis92.github.io/angular-calendar/
MIT License
2.72k stars 865 forks source link

Error on npm install #1611

Closed jpike88 closed 1 year ago

jpike88 commented 1 year ago

Describe the bug

Updating this library caused this error

npm ERR! code 127
npm ERR! path /Users/joshua/Projects/aquipa/client/node_modules/calendar-utils
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! sh: husky: command not found

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/joshua/.npm/_logs/2022-09-28T08_13_28_058Z-debug-0.log

Looks like it's due to this line https://github.com/mattlewis92/calendar-utils/blame/main/package.json#L23

Please fix

Thanks

Minimal reproduction of the problem with instructions

N/A

Screenshots

Screen Shot 2022-09-28 at 15 51 01

Versions

matts-bot[bot] commented 1 year ago

Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me

mattlewis92 commented 1 year ago

Hey there! This should have been fixed by https://github.com/mattlewis92/calendar-utils/commit/1d137d8ee3266379c740f54d08f2a8306ccd91c1

checking the published package.json you can see the postinstall script has been disabled (it's now _postinstall and not postinstall). I suspect you may have stale cache, if you do npm cache clean and try installing again it should probably fix it. Let me know if that works for you or not!

carlos-toscano commented 1 year ago

Hey there! This should have been fixed by mattlewis92/calendar-utils@1d137d8

checking the published package.json you can see the postinstall script has been disabled (it's now _postinstall and not postinstall). I suspect you may have stale cache, if you do npm cache clean and try installing again it should probably fix it. Let me know if that works for you or not!

Hi Matt, I have a similar error using the 0.10.1 version (‘cause It’s trying to execute the “postinstall” script), I saw this in the debug file generated by npm, where it gets the manifest data too. As you said before, the package content has the value in “_postinstall”, but when there’s a request to the registry, specifically here https://registry.npmjs.org/calendar-utils/0.10.1, you can see the value “postinstall”. I think this is causing the error. Maybe a new version created from the new content could fix it.

I'm using the command npm install --legacy-peer-deps

Thank you for your support.

mattlewis92 commented 1 year ago

That is so bizarre, but I don't think npm use the metadata to run postinstall scripts, I think it reads it from disk after installing the package, and in the installed package.json it's defo set to _postinstall. What npm version are you using? As I cannot reproduce this my end at all:

npm i -g npm@latest #8.19.2
mkdir calendar-test 
cd calendar-test 
npm init -y
npm i angular-calendar --legacy-peer-deps # this works fine for me
mattlewis92 commented 1 year ago

I just published calendar-utils@0.10.4 that moves husky back into a prepare script which should hopefully fix this now 🙏

carlos-toscano commented 1 year ago

I just published calendar-utils@0.10.4 that moves husky back into a prepare script which should hopefully fix this now 🙏

Thank you Matt, with this new versión 0.10.4 the error has gone.

This scenario was really rare, and I'd like to add this informatión about how I was getting the error.

git clone <my angular project> web
cd web
npm i --legacy-peer-deps

And I got the husky error

I don't know why but I was able to workaround the error by deleting the “.git” folder from my project (This is not good though) using the 0.10.1 calendar-utils version and running the installation again.

mattlewis92 commented 1 year ago

The common denominator here seems to be windows, perhaps that's why? Either way if it's fixed now in 0.10.4 it doesn't matter. Glad it's working ok now and thanks for confirming!