Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on load, Error: Cannot find module './lodash' #934

Open
dinapal opened this issue Aug 29, 2023 · 1 comment
Open

Error on load, Error: Cannot find module './lodash' #934

dinapal opened this issue Aug 29, 2023 · 1 comment

Comments

@dinapal
Copy link

dinapal commented Aug 29, 2023

JWT version: 9.0.1
error: Cannot find module './lodash'
I have tried every possible debugging from my end,
it's properly installed in my project, after a few tests when it does not work, I imported lodash, also i have removed node_modules, and reinstalled all packages. but the issue is not fixed.
please help me with it.

const jwt = require('jsonwebtoken');

whenever i require this on my project it shows the error.

node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module './lodash'
Require stack:
- C:\Users\Dina\Projects\realProject\devProject\src\node_modules\lodash\index.js
- C:\Users\Dina\Projects\realProject\devProject\src\node_modules\jsonwebtoken\sign.js
- C:\Users\Dina\Projects\realProject\devProject\src\node_modules\jsonwebtoken\index.js
- C:\Users\Dina\Projects\realProject\devProject\src\controllers\userController.js
- C:\Users\Dina\Projects\realProject\devProject\src\routes\api\userRoutes.js
- C:\Users\Dina\Projects\realProject\devProject\server.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at Object.<anonymous> (C:\Users\Dina\Projects\realProject\devProject\src\node_modules\lodash\index.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Dina\\Projects\\realProject\\devProject\\src\\node_modules\\lodash\\index.js',
    'C:\\Users\\Dina\\Projects\\realProject\\devProject\\src\\node_modules\\jsonwebtoken\\sign.js',
    'C:\\Users\\Dina\\Projects\\realProject\\devProject\\src\\node_modules\\jsonwebtoken\\index.js',
    'C:\\Users\\Dina\\Projects\\realProject\\devProject\\src\\controllers\\userController.js',
    'C:\\Users\\Dina\\Projects\\realProject\\devProject\\src\\routes\\api\\userRoutes.js',
    'C:\\Users\\Dina\\Projects\\realProject\\devProject\\server.js'
  ]
}

Node.js v19.9.0
@jakelacey2012
Copy link
Contributor

Could you use the latest version and see if you are still having issues? If not could you provide the version in which you are using in your package.json and provide context in how you are using jsonwebtoken - thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants