Home > other >  npm i error "Error: cannot find module 'nopt'"
npm i error "Error: cannot find module 'nopt'"

Time:09-28

when I tried to install node modules it threw "Error: cannot find module 'nopt" I try different methods but no one worked. I attached error message in the image below

{
  "name": "server",
  "version": "1.0.0",
  "main": "index.js",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "run": "nodemon server.js",
    "start": "node server.js"
  },
  "license": "UNLICENSED",
  "dependencies": {
    "@aws-sdk/client-sagemaker-runtime": "^3.56.0",
    "async": "^3.2.0",
    "aws-sdk": "^2.1019.0",
    "connect-mongo": "^3.2.0",
    "cookie-parser": "^1.4.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongodb": "^4.8.1",
    "mongoose": "^6.5.2",
    "morgan": "^1.10.0",
    "node-fetch": "^3.1.1",
    "node-schedule": "^2.0.0",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "serverless-http": "^2.7.0",
    "xmlhttprequest": "^1.8.0"
  },
  "devDependencies": {
    "nodemon": "^2.0.15",
    "serverless-offline": "^6.8.0"
  }

screenshot

CodePudding user response:

Please, try to remove that package, reinstall it, then reinstall npm

CodePudding user response:

Your package.json doesn't have record of nopt package so you'll have to install it by running this command in the terminal: npm i nopt

  • Related