patch-package
patch-package copied to clipboard
Cannot read property 'dependencies' of undefined
I use it in my project, then it made a mistake, the error message is shown in the figure below.
patch-package 6.2.2
β’ Creating temporary folder
TypeError: Cannot read property 'dependencies' of undefined
at Object.getPackageResolution (D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\getPackageResolution.js:71:38)
at Object.makePatch (D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\makePatch.js:49:66)
at D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\index.js:48:25
at Array.forEach (<anonymous>)
at Object.<anonymous> (D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\index.js:47:22)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\makePatch.js:183
throw e;
^
TypeError: Cannot read property 'dependencies' of undefined
at Object.getPackageResolution (D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\getPackageResolution.js:71:38)
at Object.makePatch (D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\makePatch.js:49:66)
at D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\index.js:48:25
at Array.forEach (<anonymous>)
at Object.<anonymous> (D:\Dev\React\account-book\node_modules\[email protected]@patch-package\dist\index.js:47:22)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
package.json
"devDependencies": {
"concurrently": "^5.3.0",
"json-server": "^0.16.2",
"patch-package": "^6.2.2"
}
https://github.com/ds300/patch-package/issues/234
@D-zilch this can happen if you have nothing for "dependencies" key in package.json. try making it blank: "dependencies": {}
Face the same issue when trying to run in lerna monorepo
This means it can not find the package in the package-lock.json
file. In my case, I was using:
npx patch-package History
where I should have been using:
npx patch-package history
Yes, it is case sensitive. The error message could do with improving.
I have a patch to improve the error message. No idea how to create a PR for it - currently I get a permission denied when I try to push my local branch. I'm a GitHub newbie and can't find anything about how contribute to this project. Any help?
In my case, I had both package-lock.json
and yarn.lock
files. It turns out the package-lock.json
has not been updated as I have been using yarn. I had to delete package-lock.json
file.
In my case, I had both
package-lock.json
andyarn.lock
files. It turns out thepackage-lock.json
has not been updated as I have been using yarn. I had to deletepackage-lock.json
file.
ηηζ―ε€ͺζθ°’ζ¨δΊπ
I encountered the same issue. @ds300