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

husky init not working #1334

Closed
sinbino opened this issue Jan 25, 2024 · 6 comments
Closed

husky init not working #1334

sinbino opened this issue Jan 25, 2024 · 6 comments

Comments

@sinbino
Copy link

sinbino commented Jan 25, 2024

I am using docker node:20-slim image (debian 12.4, node 20.11.0, pnpm 8.14.3).
I get an error when I follow the get started procedure.
The version of husky is 9.0.1

pnpm add --save-dev husky
pnpm exec husky init

node:internal/fs/utils:699
    throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
          ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at Object.openSync (node:fs:579:10)
    at Object.readFileSync (node:fs:457:35)
    at file:///home/node/app/node_modules/.pnpm/husky@9.0.1/node_modules/husky/bin.js:9:24
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}
@recallwei
Copy link

Same to me, It seems pnpm not working, I use npx instead.

@marcinincreo
Copy link

husky.sh file that init creates is empty when using npx

@rozbo
Copy link
Contributor

rozbo commented Jan 25, 2024

+1

@dmitriy-kudelko
Copy link

Same here

@artursudnik
Copy link

+1

rozbo pushed a commit to rozbo/husky that referenced this issue Jan 25, 2024
typicode added a commit that referenced this issue Jan 25, 2024
* fix: fix init not work on pnpm #1334

* doc: pnpm users must run init on project root

* Update bin.js

* Update bin.js

* Update get-started.md

---------

Co-authored-by: 键来! <jmpecx@outlook.com>
Co-authored-by: typicode <typicode@gmail.com>
@typicode
Copy link
Owner

It should be good now

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

7 participants