[Bug]: The "file" argument must be of type string. Received undefined
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
In my package.json I have cinfigurated a "script" like this (most data removed for making it clean):
{
"name": "",
"version": "",
"description": "",
"main": "index.html",
"author": "",
"license": "MIT",
"scripts": {
"clean": "> assets/assets/app.min.css",
},
"dependencies": {
}
}
the command actually is a very simple shell command which removes the content of this text file. This worked pretty fine with Yarn v1 (v1.22.7), but since I upgraded to V3 (v3.2.0-rc.10) it does not work.
To reproduce
try to run a predefined script in package.json and include someting like I mentioned above.
Environment
System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (6) x64 QEMU Virtual CPU version 2.5+
Binaries:
Node: 17.3.1 - /tmp/xfs-bb4d67d9/node
Yarn: 3.2.0-rc.10 - /tmp/xfs-bb4d67d9/yarn
npm: 8.3.1 - /usr/bin/npm
Additional context
Worked with Yarn 1, does not work with Yarn 3.
Thanks for looking into this, would love to upgrade, but need my scripts/commands to still work.
Full Error:
$ yarn clean
Type Error: The "file" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:120:11)
at normalizeSpawnArguments (node:child_process:503:3)
at Object.spawn (node:child_process:691:13)
at d1 (/var/www/vhosts/domain.com/httpdocs/berryTest/.yarn/releases/yarn-3.2.0-rc.10.cjs:4:7429)
at Ld.implementation (/var/www/vhosts/domain.com/httpdocs/berryTest/.yarn/releases/yarn-3.2.0-rc.10.cjs:396:18376)
at Ld.exec (/var/www/vhosts/domain.com/httpdocs/berryTest/.yarn/releases/yarn-3.2.0-rc.10.cjs:399:1582)
at Ld.run (/var/www/vhosts/domain.com/httpdocs/berryTest/.yarn/releases/yarn-3.2.0-rc.10.cjs:399:1753)
at /var/www/vhosts/domain.com/httpdocs/berryTest/.yarn/releases/yarn-3.2.0-rc.10.cjs:405:787
at /var/www/vhosts/domain.com/httpdocs/berryTest/.yarn/releases/yarn-3.2.0-rc.10.cjs:405:5028
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the predefined clean script from package.json with Yarn 3 and compare it with Yarn 1. Start from the reported child_process.spawn error and the Yarn command path shown in the stack trace. Done means the shell command runs without the undefined file error while preserving the reported script behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, shell, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100