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

tsdx create command fails at install dependencies due to husky error #943

Closed
FaberVitale opened this issue Dec 6, 2020 · 3 comments
Closed
Labels
scope: templates Related to an init template, not necessarily to core (but could influence core) scope: upstream Issue in upstream dependency solution: outdated This is not up-to-date with the current version solution: workaround available There is a workaround available for this issue

Comments

@FaberVitale
Copy link

FaberVitale commented Dec 6, 2020

Current Behavior

npx tsdx create --template 'basic' mylib

[...]
Exit code: 1
Command: node husky install
Arguments: 
Directory: [...]/node_modules/husky
Output:
husky > Setting up git hooks
fatal: not a git repository (or any of the parent directories): .git
husky > Failed to install
yarn add v1.22.10
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Fails at install dependencies phase.

The error is likely caused by the latest version of husky@4.3.4

See also: typicode/husky#822

Expected behavior

tsdx create command should install all dependencies and create a lock file.

Suggested solution(s)

Downgrade husky or pass HUSKY_SKIP_INSTALL=true.

Your environment

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 537.20 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.20.0 - ~/.nvm/versions/node/v12.20.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v12.20.0/bin/npm
  Browsers:
    Chrome: 86.0.4240.198
    Chrome Canary: 89.0.4346.0
    Firefox: 83.0
    Safari: 14.0
@jaredpalmer
Copy link
Owner

Damn. Can you submit a PR to pin Husky to v4 versions that works? Since v5 is not open source yet

@agilgur5 agilgur5 added scope: templates Related to an init template, not necessarily to core (but could influence core) scope: upstream Issue in upstream dependency solution: workaround available There is a workaround available for this issue labels Dec 7, 2020
FaberVitale added a commit to FaberVitale/tsdx that referenced this issue Dec 7, 2020
@FaberVitale
Copy link
Author

@agilgur5 agilgur5 linked a pull request Dec 7, 2020 that will close this issue
@agilgur5 agilgur5 changed the title tsdx create command fails at install dependencies tsdx create command fails at install dependencies due to husky error Dec 7, 2020
@agilgur5 agilgur5 added the solution: outdated This is not up-to-date with the current version label Dec 7, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Dec 7, 2020

Thanks for bringing this to attention @FaberVitale and providing some details and links to the upstream issue.

Downgrade husky

Can you submit a PR to pin Husky to v4 versions that works?

typicode/husky#822 (comment)

So I was going to say that downgrading and hard pinning does not actually resolve the root cause issue here and is generally not recommended for an upstream issue -- the upstream issue may itself be resolved without requiring churn from downstream and downstream of downstream consumers. Notably, this would require no less than two releases, one to hard pin, and one to remove the hard pin. I would encourage contributing upstream when possible, #511 and upstream lukeed/sade#36 is an example of this.

That is particularly true for the templates; TSDX does not control them when they are out in the wild (and so cannot later, say, upgrade the version) and actually doesn't version the deps in the templates. A hard pin can also be very confusing to users as it is inconsistent with other dependencies.

It so happens that Husky reverted this change very quickly: v4.3.5 should no longer error and so no action is required from TSDX.

fatal: not a git repository (or any of the parent directories): .git

This is the root cause, and the solution to that is actually to implement #755, which I was going to recommend if Husky did not revert. It should probably still be done to avoid such a problem in the future, although inclusion of Husky v5+ is up for debate given that it can't be used by all libraries due to license limitations

typicode/husky#822 (comment) succinctly describes that v4.3.4 simply made a silent error much louder by actually throwing (in order to resolve another issue). One of the challenges of maintaining is that a bugfix like that can sometimes also be breaking and so puts one into a precarious position. In this case, it seemed to cause more (unexpected) issues than it solved, which is likely what led to it being reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: templates Related to an init template, not necessarily to core (but could influence core) scope: upstream Issue in upstream dependency solution: outdated This is not up-to-date with the current version solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants