Internal/Modules/Cjs/Loader.Js:582 Throw Err

internal/modules/cjs/loader.js:582 throw err

I had the same issue when I first tried on node js.

I noticed this issue was happening to me because I had some .js files with same names in different directories, which were in the same main directory.

I created another directory outside the main project folder, and created a .js file.

After that, it ran fine.

ex- app.js

internal/modules/cjs/loader.js:582 throw err

I had the same issue when I first tried on node js.

I noticed this issue was happening to me because I had some .js files with same names in different directories, which were in the same main directory.

I created another directory outside the main project folder, and created a .js file.

After that, it ran fine.

ex- app.js

internal/modules/cjs/loader.js:883 throw err

After spending a lot of time on the issue, I finally found the solution.

I've uninstalled "NodeJs" completely, deleted "NPM" & "NPM-Cache" from:

C:\Users\username\AppData\Roaming

and restarted the PC. Then I've re-installed everything.


If the issue remains, check your folder names.

In my case, the Angular project was inside a folder named "Research & Development":

C:\Users\Asus\Documents\Research & Development\Video conference project\myapplication

I have removed the special character "&" and renamed the folder to "Research-Development"

After the rename, npm start executed without errors.

Command line screenshot

internal/modules/cjs/loader.js:968 throw err; keeps preventing me from running node, but why?

Error: Cannot find module '/Users/test/Desktop/Git/**`Project IA`**/Project-IA/server.js'

Another mistake is the name of the folder (/ Project IA /), it is written separated by "empty space", never, never name your project folders using 2 words separating with "empty space".

Use "_" underscore, "-", hyphen / minus, example:
'/Users/test/Desktop/Git/Project_IA/Project-IA/server.js'.

The error is persisting because the file "server.js" is not in the "root" folder of the project.
Move the file "server.js" to the root folder of the project, rename the folder "Project IA" to "IA-Project", or any other name you like, and the error will be solved!

I'm using google translator
My language is Brazilian Portuguese

NodeJS error: internal/modules/cjs/loader.js:905-Cannot find module './config'

In db.js file you have const config = require('./config');, the system will search for config.js file in the same folder of db.js file, which isn't available, hence the error.

To read the default.json file and get the mongodb connection string, you can try this way:

const config = require('./default.json'); // config is a javascript object
const db = config.mongoURI;

internal/modules/cjs/loader.js:456 throw e; ^ Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No exports main defined in

chnage the .js file to

const { initializeApp } = require('firebase/app')
const config = require('./config');

const db = initializeApp(config.firebaseConfig);

module.exports = db;

refer to firebase

how to solve it: internal/modules/cjs/loader.js:883

try removing node_modules folder and run yarn install again



Related Topics



Leave a reply



Submit