question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'dependencies' of undefined

See original GitHub issue

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\_patch-package@6.2.2@patch-package\dist\getPackageResolution.js:71:38)
    at Object.makePatch (D:\Dev\React\account-book\node_modules\_patch-package@6.2.2@patch-package\dist\makePatch.js:49:66)
    at D:\Dev\React\account-book\node_modules\_patch-package@6.2.2@patch-package\dist\index.js:48:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (D:\Dev\React\account-book\node_modules\_patch-package@6.2.2@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\_patch-package@6.2.2@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\_patch-package@6.2.2@patch-package\dist\getPackageResolution.js:71:38)
    at Object.makePatch (D:\Dev\React\account-book\node_modules\_patch-package@6.2.2@patch-package\dist\makePatch.js:49:66)
    at D:\Dev\React\account-book\node_modules\_patch-package@6.2.2@patch-package\dist\index.js:48:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (D:\Dev\React\account-book\node_modules\_patch-package@6.2.2@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"
  }

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
chrismcleodcommented, May 6, 2021

@D-zilch this can happen if you have nothing for “dependencies” key in package.json. try making it blank: "dependencies": {}

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'dependencies' of undefined ...
Using yarn and: yarn patch-package your-pckg-name results to: • Creating temporary folder TypeError: Cannot read property 'dependencies' of undefined.
Read more >
Cannot Read Property of undefined Object in dependencies ...
If I have a dependency which is router.asPath , but sometimes the router is null, which may cause the function crash. In order...
Read more >
Fix for cannot 'TypeError: Cannot read property' when ...
In the end, the fix was simple, make sure all the other Jest related packages were updated to 28.x versions. Once I did...
Read more >
npm err! cannot read properties of undefined (reading 'name')
Solution 1: Clear Cache. First you need to clear your cache by this command: npm cache clear --force. Now, run npm install command....
Read more >
patch-package - npm
fix a bug in one of your dependencies vim ... If it's a transitive dependency patch-package can't detect that it is safe to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found