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.

MODULE_NOT_FOUND: react-hook-form/dist/index.js

See original GitHub issue

Describe the bug After updting from 6.9.2 to 6.9.3, I am keep getting this error.

Error: Cannot find module '/home/hello/Documents/code/hrms/node_modules/react-hook-form/dist/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:315:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:818:27)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/hello/Documents/code/project/node_modules/@hookform/resolvers/dist/zod.js:4:27)
    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) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/hello/Documents/code/project/node_modules/react-hook-form/package.json',
  requestPath: 'react-hook-form'
}

When I checked the node_modules/react-hook-form, indeed there was no dist/index.js.

Packages

  • react: 16.4.0
  • react-hook-form: 6.9.3
  • @hookform/resolvers: 1.0.0
  • nextjs: 9.5.5
  • Typescript: 4.0.3

Desktop (please complete the following information):

  • OS: Manjaro Linux
  • Browser: Chromium 86

Additional context I tried reinstalling packages after deleting node_modules but no luck.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
alenvlahovljakcommented, Jan 17, 2021

Try to delete node_modules, then install it again. I’m using Yarn, and that solved the problem.

0reactions
bluebill1049commented, Oct 18, 2020

i have reverted the script change at master and republish a patch for this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-hook-form - npm
Performant, flexible and extensible forms library for React Hooks. Latest version: 7.41.1, last published: a day ago.
Read more >
Error in building app with react-hook-form using TS
According to this discussion, react-hook-form v7 needs TS 4.1 above.
Read more >
Migrate From V6 to V7 - Simple React forms validation
Hi there,. React Hook Form focus on the following aspect on Version 7: (DX) Strict typed form. Reduce package size. Performance enhancements.
Read more >
cannot find module 'yup' or its corresponding type declarations
react -hook-form/resolversFailing to build#44 ... javascript const {chromium, webkit, ... src/index.tsx:1:11 - error TS2307: Cannot find module ...
Read more >
Cannot find module 'react' Error in TypeScript | bobbyhadz
If the error is not resolved, try to delete your node_modules and package-lock.json files, re-run npm install and restart your IDE. shell.
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