Fails to create patch file for complex package version
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 325
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for your work on this! I really hope we can start using it in our project. We are currently using a canary build of a package, `gatsby-source-contentful` and installing it using a non-standard version. However, when I try to create a patch, there is a failure finding associated data in the lock file.
```
$ yarn patch-package gatsby-source-contentful
yarn run v1.22.5
$ /Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/.bin/patch-package gatsby-source-contentful
patch-package 6.2.2
• Creating temporary folder
Error: Can't find lockfile entry for gatsby-source-contentful
at Object.getPackageResolution (/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/getPackageResolution.js:41:19)
at Object.makePatch (/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/makePatch.js:49:66)
at /Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/index.js:48:25
at Array.forEach ()
at Object. (/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/index.js:47:22)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/makePatch.js:183
throw e;
^
Error: Can't find lockfile entry for gatsby-source-contentful
at Object.getPackageResolution (/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/getPackageResolution.js:41:19)
at Object.makePatch (/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/makePatch.js:49:66)
at /Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/index.js:48:25
at Array.forEach ()
at Object. (/Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/patch-package/dist/index.js:47:22)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
It also fails if I try to supply the explicit version as it is shown in the lock file:
```
$ yarn patch-package 'gatsby-source-contentful@^2.3.55-next.21'
yarn run v1.22.5
$ /Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/.bin/patch-package gatsby-source-contentful@^2.3.55-next.21
patch-package 6.2.2
No such package gatsby-source-contentful@^2.3.55-next.21
File not found: /Users/davidhouse/Code/sandbox/frontend/butcherbox-frontend/node_modules/gatsby-source-contentful@^2.3.55-next.21/package.json
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
_package.json_
```
"gatsby-source-contentful": "^2.3.55-next.21",
```
_yarn.lock_
```
gatsby-source-contentful@^2.3.55-next.21:
version "2.3.55-next.21"
resolved "https://registry.yarnpkg.com/gatsby-source-contentful/-/gatsby-source-contentful-2.3.55-next.21.tgz#0e8f15f87061c094efcbd1f02dc6a87389c72b54"
integrity sha512-tXWbaA7ByB5QbQs6if4LsnlN11H0F5VZn/oBFfWh1lI5Cb7U+GxfszxWZ/9Wp7U8jOAKaNdZq3BsNIXvXPCA1A==
dependencies:
"@babel/runtime" "^7.11.2"
"@contentful/rich-text-react-renderer" "^14.1.1"
"@contentful/rich-text-types" "^14.1.1"
"@hapi/joi" "^15.1.1"
axios "^0.20.0"
base64-img "^1.0.4"
bluebird "^3.7.2"
chalk "^4.1.0"
contentful "^7.14.7"
fs-extra "^9.0.1"
gatsby-core-utils "1.3.23"
gatsby-plugin-utils "0.2.33"
gatsby-source-filesystem "2.3.34"
is-online "^8.5.0"
json-stringify-safe "^5.0.1"
lodash "^4.17.20"
node-fetch "^2.6.1"
progress "^2.0.3"
qs "^6.9.4"
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.