2

After installing express-jwt-blacklist, when I import it, it says it can't find the declaration file for the module.

My package.json dependencies:

{
  "name": "es6express",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "cross-env NODE_ENV=production && npm run server:prod",
    "server:prod": "node dist/app.js",
    "build": "babel app.js --out-dir build",
    "clean": "rimraf dist",
    "server": "cross-env DEBUG=app nodemon --exec babel-node app.js",
    "dev": "cross-env NODE_ENV=development npm-run-all server",
    "prod": "npm-run-all clean build",
    "format": "prettier --write \"./**/*.js\""
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^4.0.1",
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "cross-env": "^7.0.2",
    "debug": "^4.1.1",
    "express": "^4.17.1",
    "express-jwt": "^6.0.0",
    "express-jwt-blacklist": "^1.1.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.9.6",
    "morgan": "^1.10.0",
    "rand-token": "^1.0.1",
    "lint": "eslint modules/**/*.js"
  },
  "devDependencies": {
    "@babel/cli": "^7.10.5",
    "@babel/core": "^7.9.0",
    "@babel/node": "^7.10.5",
    "@babel/preset-env": "^7.9.0",
    "babel-loader": "^8.1.0",
    "eslint": "^7.11.0",
    "nodemon": "^2.0.2",
    "npm-run-all": "^4.1.5",
    "prettier": "^1.19.1",
    "rimraf": "^3.0.2"
  }
}
8
  • does your node_modules folder contain the express-jwt-blacklist package? Can you include your import statement? Commented Oct 22, 2020 at 10:50
  • yes, also import it like import blacklist from 'express-jwt-blacklist' Commented Oct 22, 2020 at 10:54
  • 1
    This is the ES6 import format. For Node try the ES5 format : const blacklist = require('express-jwt-blacklist'); Commented Oct 22, 2020 at 11:00
  • Yes, I know but I am using es6 syntax also i tried es5 syntax but still doesn't work. Commented Oct 22, 2020 at 11:13
  • with such few info, it's hard to understand the problem. can you post the complete error message, a code snippet, or try to reinstall all modules with npm install Commented Oct 22, 2020 at 11:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.