0

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

  1. Removed node modules folder and installed again

  2. Cleared cache and installed again

  3. 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"
  }
}
Sarath Kumar
  • 988
  • 13
  • 34

3 Answers3

1

The jose package exports individual ESM modules, as in, there's no root jose module in version 3.x that you're installing. You can read how to require/import each individual module in the project's documentation

Filip Skokan
  • 616
  • 4
  • 4
0

Update your NodeJS runtime. Fixed the issue for me.

SummmerFort
  • 153
  • 1
  • 5
-2

Maybe you should use npm install --save-dev jose to install jose :D

farvilain
  • 2,326
  • 1
  • 10
  • 23
  • that's the first thing I done. thanks for the info :D – Sarath Kumar Nov 28 '20 at 05:58
  • Not sure to understand... Is the `Installed npm install @types/node --save-dev` just a typo by copy/paste and you are ironic? Or did you did this mistake and you're are happy to realize it? I'm confuse. And the second case, give a link to the github to see package.json and so... – farvilain Nov 28 '20 at 06:13
  • I updated my package.json file please check.thanks – Sarath Kumar Nov 28 '20 at 06:22
  • Ok not helping, if you have a github with the project, maybe it can be fixed quickly – farvilain Nov 28 '20 at 06:26