read upper package.json
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 325
- PR merge metrics
- No merged PRs in 30d
Description
I'm getting this error when running `npx patch-package` while in a subfolder of my project
```
npx: installed 150 in 25.429s
patch-package 6.2.2
• Creating temporary folder
Error: Can't find yarn.lock file
at Object.getPackageResolution (/Users/haroen/.npm/_npx/72757/lib/node_modules/patch-package/dist/getPackageResolution.js:19:23)
at Object.makePatch (/Users/haroen/.npm/_npx/72757/lib/node_modules/patch-package/dist/makePatch.js:49:66)
at /Users/haroen/.npm/_npx/72757/lib/node_modules/patch-package/dist/index.js:48:25
at Array.forEach ()
at Object. (/Users/haroen/.npm/_npx/72757/lib/node_modules/patch-package/dist/index.js:47:22)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Can't find yarn.lock file
```
Maybe something like `read-pkg-up` could be useful? I haven't yet looked at the source code of course
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce `npx patch-package` from a project subfolder, then start at `getPackageResolution.js`, which the trace shows being called by `makePatch.js`. Confirm that the command locates the project’s upper-level `package.json` and `yarn.lock` rather than only checking the current directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100