0

I trying to host my nodejs backend service using AWS Ec2 Ubuntu. But the problem is the JWT package couldn't be install correctly. It showed Please verify that the package.json has a valid "main" entry and Deprecation Warning. My backend is hosted but it showed this JWT issue.

Error: Cannot find module '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:400:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:613:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:981:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/lib/node_modules/pm2/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/src/middlewares/isAuth.ts:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Module.m._compile (/usr/lib/node_modules/pm2/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1219:10) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json',
  requestPath: 'jsonwebtoken'
}
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author

Error

My ubuntu directory directory

jsonweb

I search about this issue about few hours already, but seem like no one faced this issue before. Anyone can help me on this issue thanks

0 Answers0