I installed the module. Only this module is not working other modules are working fine. When I trying to run it it's throwing following error
Error: Cannot find module 'jose'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (<my_folder>\test.js:1:100)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
What I tried:
Almost everything from this stackoverflow question
Removed node modules folder and installed again
Cleared cache and installed again
Installed
npm install @types/node --save-dev
my package.json
{
"name": "test-api",
"version": "1.0.0",
"description": "",
"scripts": {
"start": "func start",
"test": "echo \"No tests yet...\""
},
"dependencies": {
"axios": "^0.21.0",
"axios-retry": "^3.1.9",
"fs-extra": "^9.0.1",
"qs": "^6.9.4"
},
"devDependencies": {
"@types/node": "^14.14.10",
"jose": "^3.1.3"
}
}
The
jose
package exports individual ESM modules, as in, there's no rootjose
module in version 3.x that you're installing. You can read how to require/import each individual module in the project's documentation