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

Installing a dev dependency when filtering fails when postinstall script runs pnpm dlx #7424

Closed
2 of 4 tasks
QuiiBz opened this issue Dec 15, 2023 · 2 comments · Fixed by #7540
Closed
2 of 4 tasks

Comments

@QuiiBz
Copy link

QuiiBz commented Dec 15, 2023

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

No response

Which area(s) of pnpm are affected? (leave empty if unsure)

CLI

Link to the code that reproduces this issue or a replay of the bug

QuiiBz/sherif#45 (comment)

Reproduction steps

Installing a dev dependency when the root package.json contains a postinstall script being pnpm dlx ... fails with The "path" argument must be of type string. Received undefined.

To reproduce:

git clone https://github.com/t3-oss/create-t3-turbo
cd create-t3-turbo
pnpm i

# Install some dep - works
pnpm add -F nextjs @types/leaflet

# Install some dev dep - fails
pnpm add -F nextjs -D @types/leaflet

You can try to use any other package inside postinstall, e.g. pnpm dlx husky-init also fails with the same error.

Describe the Bug

pnpm install fails with the following error, only when installing a dev dependency and with a postinstall script being pnpm dlx ...

. postinstall$ pnpm dlx husky-init
│ Progress: resolved 1, reused 0, downloaded 0, added 0
│ Packages: +2
│ ++
│ Progress: resolved 2, reused 2, downloaded 0, added 2, done
│  ERR_INVALID_ARG_TYPE  The "path" argument must be of type string. Received undefined
│ pnpm [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
│     at new NodeError (node:internal/errors:405:5)
│     at validateString (node:internal/validators:162:11)
│     at Object.join (node:path:1171:7)
│     at getBinName (/Users/tom/.proto/tools/pnpm/8.12.1/dist/pnpm.cjs:210085:37)
│     at Object.handler [as dlx] (/Users/tom/.proto/tools/pnpm/8.12.1/dist/pnpm.cjs:210061:54)
│     at async /Users/tom/.proto/tools/pnpm/8.12.1/dist/pnpm.cjs:219843:21
│     at async main (/Users/tom/.proto/tools/pnpm/8.12.1/dist/pnpm.cjs:219810:34)
│     at async runPnpm (/Users/tom/.proto/tools/pnpm/8.12.1/dist/pnpm.cjs:220067:5)
│     at async /Users/tom/.proto/tools/pnpm/8.12.1/dist/pnpm.cjs:220059:7

Expected Behavior

It should run pnpm dlx ... without failing and complete the installation of the dev dependency, similar to normal dependencies.

Which Node.js version are you using?

18.18.2

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

@QuiiBz QuiiBz changed the title Installing a dev dependency fails when postinstall script runs pnpm dlx Installing a dev dependency when filtering fails when postinstall script runs pnpm dlx Dec 15, 2023
@RobRoseKnows
Copy link

I am also experiencing this issue on WSL 2 and Node version 20.10.0. pnpm version 8.14.1

zkochan added a commit that referenced this issue Jan 19, 2024
…7540)

close #7424

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
zkochan added a commit that referenced this issue Jan 19, 2024
…7540)

close #7424

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
@bgolubovic
Copy link

I am also experiencing this issue on WSL 2 and Node version 20.10.0. pnpm version 8.14.1

The same here.

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.

3 participants