I’m on the project logging page using JWT in node js. But today, when I was running the “nodemon index or nodemon index.js” command on vscode terminal, I got a message like this.
PS E:OneDriveDocumentsJWT AUTHjsonwebt> nodemon index [nodemon] 2.0.15 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node index index.js` internal/process/esm_loader.js:74 internalBinding('errors').triggerUncaughtException( ^ Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'E:OneDriveDocumentsJWT AUTHjsonwebtnode_modulessequelizedist' is not supp orted resolving ES modules imported from E:OneDriveDocumentsJWT AUTHjsonwebtcontrollersusers.js at finalizeResolution (internal/modules/esm/resolve.js:272:17) at moduleResolve (internal/modules/esm/resolve.js:699:10) at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11) at Loader.resolve (internal/modules/esm/loader.js:86:40) at Loader.getModuleJob (internal/modules/esm/loader.js:230:28) at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:56:40) at link (internal/modules/esm/module_job.js:55:36) { code: 'ERR_UNSUPPORTED_DIR_IMPORT', url: 'file:///E:/OneDrive/Documents/JWT%20AUTH/jsonwebt/node_modules/sequelize/dist' } [nodemon] app crashed - waiting for file changes before starting...
This just happened, because yesterday when I used the command, it was all right.
And this is the result when I run “dir”.
PS E:OneDriveDocumentsJWT AUTH> dir PS E:OneDriveDocumentsJWT AUTHjsonwebt> dir Directory: E:OneDriveDocumentsJWT AUTHjsonwebt Mode LastWriteTime Length Name ---- ------------- ------ ---- da---l 1/11/2022 2:42 PM config da---l 1/11/2022 3:31 PM controllers da---l 1/11/2022 3:01 PM models da---l 1/11/2022 2:35 PM node_modules da---l 1/11/2022 3:35 PM routes -a---l 1/11/2022 5:04 PM 115 .env -a---l 1/13/2022 9:01 AM 448 index.js -a---l 1/11/2022 2:33 PM 44993 package-lock.json -a---l 1/13/2022 8:44 AM 515 package.json -a---l 1/13/2022 8:48 AM 226 request.rest
Is there any advice that can help me? TIA^^
here’s my package.json
{
"name": "jsonwebt",
"version": "1.0.0",
"description": "json web token login",
"main": "index.js",
"type": "module",
"scripts": {
"start": "nodemon index.js",
"test": "echo "Error: no test specified" && exit 1"
},
"author": "rara",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dotenv": "^11.0.0",
"express": "^4.17.2",
"jsonwebtoken": "^8.5.1",
"mysql2": "^2.3.3",
"sequelize": "^6.13.0"
}
}
here’s my index.js
import express from "express";
import dotenv from "dotenv"
import db from "./config/database.js";
import router from "./routes/index.js";
dotenv.config();
const app = express();
try {
await db.authenticate();
console.log('CONGRATULATIONS!! Database Connected...');
} catch (error) {
console.error(error);
}
app.use(express.json());
app.use(router);
app.listen(5000, () => console.log('Server Running at Port 5000'));