nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.46k stars 279 forks source link

internal/modules/cjs/loader.js 584 throw err; ==> cannot find module core-util-is #1846

Closed subhrajitroy1989 closed 5 years ago

subhrajitroy1989 commented 5 years ago
ArunTeltia commented 4 years ago

okay i got the same error because i was not in my project main file i was somewhere outside my file and after changing my directory i dont get that error anymore so please check for that as well if you are getting that error

shubhsk88 commented 4 years ago

I solved the error by making the changes in my package.json file and when I installed express in my localhost it was mentioned in devDependencies and when I deployed to Heroku I changed the express mention from devDependencies to dependencies and it works out very well. I hope this will be helpful.It took me so long to correct it

mrferris commented 4 years ago

Has anybody explained why this happens? I read this thread and may have missed it. I didn't change anything about my code and suddenly got this error. I'm running on an EC2, I wonder if something about the system changed?

Regardless, rm -rf node_modules && rm package-lock.json && npm install fixed this for me. Thanks!

misolo commented 4 years ago

I had the same error after upgrading the node, was resolved simply by restarting the computer

ghost commented 4 years ago

I can't figure this out. I've been trying all day.

=== npm audit security report ===                        

                             Manual Review                                  
         Some vulnerabilities require your attention to resolve             

      Visit https://go.npm.me/audit-guide for additional guidance           

Low Incorrect Handling of Non-Boolean Comparisons During
Minification

Package uglify-js

Patched in >= 2.4.24

Dependency of jade

Path jade > transformers > uglify-js

More info https://npmjs.com/advisories/39

Low Regular Expression Denial of Service

Package uglify-js

Patched in >=2.6.0

Dependency of jade

Path jade > transformers > uglify-js

More info https://npmjs.com/advisories/48

Critical Sandbox Bypass Leading to Arbitrary Code Execution

Package constantinople

Patched in >=3.1.1

Dependency of jade

Path jade > constantinople

More info https://npmjs.com/advisories/568

Low Regular Expression Denial of Service

Package clean-css

Patched in >=4.1.11

Dependency of jade

Path jade > clean-css

More info https://npmjs.com/advisories/785

found 4 vulnerabilities (3 low, 1 critical) in 3752 scanned packages 4 vulnerabilities require manual review. See the full report for details.

Prathyusha1117 commented 4 years ago

@Sruth8 What's the node and npm version you are using? Please post the package-json

o

Prathyusha1117 commented 4 years ago

where to post on cmd or

ghost commented 4 years ago
C:\Users\kelse>node --versionv12.16.1  Sent from Mail for Windows 10 From: prathyushaRedSent: Monday, March 2, 2020 11:08 PMTo: nodejs/helpCc: Kelsey Metter; CommentSubject: Re: [nodejs/help] internal/modules/cjs/loader.js 584 throw err; ==> cannot find module core-util-is (#1846) where to post on cmd or—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe. 
ghost commented 4 years ago

C:\Users\kelse>node --version v12.16.1

ghost commented 4 years ago

Error: Cannot find module 'express' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object. (/app/server.js:7:17) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) 🐞 The debugger could not be started. See https://glitch.com/faq#debugger internal/modules/cjs/loader.js:584 throw err; ^ Error: Cannot find module 'express' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object. (/app/server.js:7:17) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3)

anibabbar commented 4 years ago

npm run clean && npm run build worked for me !!

theslyprofessor commented 4 years ago

npm run clean && npm run build worked for me !!

When I try that I get npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/nakultiruviluamala/package.json

I'm really desperate to get this to work.

Thanks, Nakul

anibabbar commented 4 years ago

npm run clean && npm run build worked for me !!

When I try that I get npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/nakultiruviluamala/package.json

I'm really desperate to get this to work.

Thanks, Nakul

try : https://github.com/nodejs/help/issues/1846#issuecomment-480563345

theslyprofessor commented 4 years ago

npm run clean && npm run build worked for me !!

When I try that I get npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/nakultiruviluamala/package.json I'm really desperate to get this to work. Thanks, Nakul

try : #1846 (comment)

When I do the last step:npm i core-util-is

I get this error: npm WARN saveError ENOENT: no such file or directory, open '/Users/nakultiruviluamala/package.json'

Any idea why?

Thanks, Nakul

aSrivastaava commented 4 years ago

internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module 'uws' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (F:/chatapp/src/index.js:7:1) at Module._compile (internal/modules/cjs/loader.js:778:30) at loader (F:\chatapp\node_modules\babel-register\lib\node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (F:\chatapp\node_modules\babel-register\lib\node.js:154:7) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

elderon89 commented 4 years ago

Could someone help?

internal/modules/cjs/loader.js:979 throw err; ^

Error: Cannot find module 'E:\Projetos\testes\ubots\backend\index.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
at Function.Module._load (internal/modules/cjs/loader.js:859:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } [nodemon] app crashed - waiting for file changes before starting...

Did everything above, with no results :(

AksCA commented 4 years ago

npm install succeeded. However on running "next build src" command it fails with the following message in linux machine.

next build src

sh: next: not found npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT npm ERR! @fl-ukdeploy/fsheet-ui@1.0.0 build: next build src npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the @fl-ukdeploy/fsheet-ui@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /appuser/.npm/_logs/2020-04-10T13_12_27_971Z-debug.log

node --version v12.12.0
npm --version 6.11.3

Digging further found the following:

ls -latr ./node_modules/next/dist/bin total 8 -rwxr-xr-x 1 appuser appgroup 4283 Oct 26 1985 next drwxr-xr-x 13 appuser appgroup 159 Apr 10 13:21 .. drwxr-xr-x 2 appuser appgroup 18 Apr 10 13:25 .

ls -latr ./node_modules/.bin/next ls: ./node_modules/.bin/next: No such file or directory

This happens some times. Some times it worked as well.

Any inputs on this please?

LuizGMX commented 4 years ago

npm run clean && npm run build worked for me !!

after many tries, this was the only one that worked for me Thanks!! what i did: npm install clean npm clean npm build

faizantariq1 commented 4 years ago

Note: It's running on android side but giving error on ios side. when adding realm library.

Using Node.js v12.16.2 internal/modules/cjs/loader.js:983 throw err; ^

Error: Cannot find module '/Users/faraztariq/Desktop/Naseeb' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) at Function.Module._load (internal/modules/cjs/loader.js:862:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) at internal/main/run_main_module.js:18:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } Command PhaseScriptExecution failed with a nonzero exit code

TecateWine commented 4 years ago

Anyone help me with this? I have uninstalled, reinstalled, and repaired nodejs probably half a dozen times now. I get this error with every npm command. OS: Win10:

internal/modules/cjs/loader.js:960 throw err; ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15) at Function.Module._load (internal/modules/cjs/loader.js:840:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) at internal/main/run_main_module.js:18:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

dfrank43 commented 4 years ago

I am getting the exact same thing. What is the deal???

faizantariq1 commented 4 years ago

@dfrank43 @TecateWine in my case. I have a space in source repo "folder name" in my system. I just remove that space and It's work for me.

peterl74 commented 4 years ago

@dfrank43 @TecateWine in my case. I have a space in source repo "folder name" in my system. I just remove that space and It's work for me.

I had an ampersand in the folder name, thanks.

anguschp commented 4 years ago

okay i got the same error because i was not in my project main file i was somewhere outside my file and after changing my directory i dont get that error anymore so please check for that as well if you are getting that error

This works. I cloned the whole project in a directory and that's create a sub folder inside another folder. After re-arrange the diredctory, problem solved

marcosparreira10 commented 4 years ago

I corrected this error, returning to the visual code, deleting the file and making the file again. It seems that this file only recognized in the visual code, that if it is in the project folder the file is not there. And this error is the error of not having found the file. That's how I fixed this defect. My file that reads the cmd port, server.js misses

abdelrhmanshokr commented 4 years ago

I was getting this error => Error: Cannot find module 'my_file_path/index.js'

and for some reason in package.json main field was set to index.js and my main file was called app.js so I changed "main": "index.js", to "main": "app.js",

SVladikO commented 4 years ago

I've got this issue because I was in wrong folder. Check your path in terminal.

SathwikaGone commented 4 years ago

Has anybody explained why this happens? I read this thread and may have missed it. I didn't change anything about my code and suddenly got this error. I'm running on an EC2, I wonder if something about the system changed?

Regardless, rm -rf node_modules && rm package-lock.json && npm install fixed this for me. Thanks!

hey thanks that worked for me. I just followed these three commands > rm -rf node_modules && rm package-lock.json && npm install. THANK YOU

ridwan102 commented 4 years ago

Great! This fix worked for me thank you

olufemi424 commented 4 years ago
rm -rf node_modules
npm install -g npm@latest
npm i core-util-is

Works ✔

junhwong commented 4 years ago

not works https://github.com/nodejs/help/issues/2644#issuecomment-649075086

Alsaheem commented 4 years ago

thanks

Base29 commented 4 years ago

Hello guys I am also getting this error on my node application when I build it for production

10|graphql | at Module. (/root/blonk-api-v2/app.js:1:3572) 10|graphql | at t (/root/blonk-api-v2/app.js:1:110) 10|graphql | at /root/blonk-api-v2/app.js:1:903 10|graphql | at Object. (/root/blonk-api-v2/app.js:1:913) 10|graphql | Error: Cannot find module '@babel/runtime/regenerator' 10|graphql | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) 10|graphql | at Function.Module._load (internal/modules/cjs/loader.js:562:25) 10|graphql | at Module.require (internal/modules/cjs/loader.js:692:17) 10|graphql | at require (internal/modules/cjs/helpers.js:25:18) 10|graphql | at Object. (/root/blonk-api-v2/app.js:1:939) 10|graphql | at t (/root/blonk-api-v2/app.js:1:110) 10|graphql | at Module. (/root/blonk-api-v2/app.js:1:3572) 10|graphql | at t (/root/blonk-api-v2/app.js:1:110) 10|graphql | at /root/blonk-api-v2/app.js:1:903 10|graphql | at Object. (/root/blonk-api-v2/app.js:1:913)

This is my package.json

{ "name": "graphql-api", "version": "2.0.0", "description": "New API using GraphQL", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "nodemon --exec babel-node app.js", "build-dev": "rm -rf dist && webpack --mode development", "build-prod": "rm -rf dist && webpack --mode production" }, "author": "Faisal Hussain", "license": "ISC", "dependencies": { "@babel/runtime": "^7.10.4", "@hapi/joi": "^15.1.1", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", "cors": "^2.8.5", "dotenv": "^8.2.0", "express": "^4.17.1", "express-graphql": "^0.9.0", "graphql": "^15.1.0", "graphql-merge-resolvers": "^1.1.16", "handlebars": "^4.7.6", "jsonwebtoken": "^8.5.1", "mongoose": "^5.9.18", "mongoose-autopopulate": "^0.12.2", "multer": "^1.4.2", "nodemailer": "^6.4.10", "nodemailer-mailgun-transport": "^2.0.0", "regenerator-runtime": "^0.13.5", "webpack": "^4.43.0", "webpack-cli": "^3.3.12", "webpack-node-externals": "^1.7.2" }, "devDependencies": { "@babel/cli": "^7.10.3", "@babel/core": "^7.10.3", "@babel/node": "^7.10.3", "@babel/plugin-transform-async-to-generator": "^7.10.1", "@babel/plugin-transform-runtime": "^7.10.3", "@babel/polyfill": "^7.10.1", "@babel/preset-env": "^7.10.3", "babel-loader": "^8.1.0", "nodemon": "^2.0.4" } }

I have nvm installed. I tried with node version 8.17.0 and 10.19.0. NPM Version = 6.14.5

Jay-Jay13 commented 4 years ago

Hello! Can someone help me? I am getting an error message.

Error: Cannot find module 'ejs' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at new View (/workspace/Test/node_modules/express/lib/view.js:81:14) at Function.render (/workspace/Test/node_modules/express/lib/application.js:570:12) at ServerResponse.render (/workspace/Test/node_modules/express/lib/response.js:1012:7) at /workspace/Test/MoreExpress/EJSDemo/app.js:9:6 at Layer.handle [as handle_request] (/workspace/Test/node_modules/express/lib/router/layer.js:95:5) at next (/workspace/Test/node_modules/express/lib/router/route.js:137:13)

Here is the package.json: { "name": "ejsdemo", "version": "3.0.1", "description": "Sample EJS exercise", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "license": "ISC", "dependencies": { "ejs": "^3.1.3" } }

TIA.

s4ff0x commented 4 years ago

I had same issue. I just have renamed folder, which had been containing problem file, and it's working now. Maybe it was just reserved name or another nodejs package had it already

Jay-Jay13 commented 4 years ago

All is good neokkers. I figured out a resolution already. Thanks anyway.

asmaaomar66 commented 4 years ago

Struggled with this error all day using a MERN stack. I fixed it by adding this line to my package.json in on the server side.

"client": "npm start --prefix client"

I can't found the server side in my package.json !! my package.json is { "name": "functions", "description": "Cloud Functions for Firebase", "scripts": { "lint": "eslint .", "serve": "firebase emulators:start --only functions", "shell": "firebase functions:shell", "start": "npm run shell", "deploy": "firebase deploy --only functions", "logs": "firebase functions:log" }, "engines": { "node": "8" }, "dependencies": { "algoliasearch": "^4.3.0", "firebase-admin": "^8.10.0", "firebase-functions": "^3.6.1" }, "devDependencies": { "eslint": "^5.12.0", "eslint-plugin-promise": "^4.0.1", "firebase-functions-test": "^0.2.0" }, "private": true }

J-Colin commented 4 years ago

npm run clean && npm run build worked for me !!

after many tries, this was the only one that worked for me Thanks!! what i did: npm install clean npm clean npm build

This one worked for me. Thanks!

TomaIvanovTomov commented 4 years ago

Nodejs, npm, the biggest bullshits ever made. Every single command in terminal throws some error. Wasting days to resolve some errors before even start making the real app. How is that possible ....

faizantariq1 commented 4 years ago

@TomaIvanovTomov same happens to me when I start react-native. I just resolve the issue one by one and then good to go.

Ezra-Siton-UIX commented 4 years ago

I so much hate not semantic "no clue" how to solve console errors (0 from 10 the score of this console Nightmare Error ==> Hundreds of messages her = Hundreds of your users get stuck because of this issue). I solve my issue by this Q (But why in the first place did I have to get here + Why this issue is closed?).

Maybe Open the fridge and close :) To solve this issue.

AndersonRioba commented 4 years ago

npm run clean && npm run build worked for me !!

after many tries, this was the only one that worked for me Thanks!! what i did: npm install clean npm clean npm build

Thanks a lot for this.For my case i have used : npm install clean then npm rebuild

morange commented 4 years ago

Hey folks, i have an similar error on my mac (Catalina) :(

OS: macOS 10.15.6 node v10.18.0 npm 6.13.4

the error: Error: Cannot find module './lib/js-yaml.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/usr/local/lib/node_modules/foundation-cli/node_modules/js-yaml/index.js:4:12) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Who can give me a tip on how to eliminate the error?

Many thanks for your help m.orange

addaleax commented 4 years ago

@morange That’s a different issue, so maybe you could open a new ticket here in the repository?

Either way, it might help to run npm uninstall -g foundation-cli && npm install -g foundation-cli.

wcdeich4 commented 3 years ago

it finally worked for me after I did sudo npm i cjs-loader (and make sure to install express, not just express-http-proxy)

wcdeich4 commented 3 years ago

it finally worked for me after I did sudo npm i cjs-loader (and make sure to install express, not just express-http-proxy)

amrony commented 3 years ago

image

mounika-13 commented 3 years ago

Error: Cannot find module 'C:\Users\CHEERA\Desktop\Web development using vscode\day9-10\app.js' ←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)←[39m ←[90m at Function.Module._load (internal/modules/cjs/loader.js:841:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m ←[90m at internal/main/run_main_module.js:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }

Can anyone solve this please

saurishkar commented 3 years ago

I was trying to run gulp -v and i received this error:

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'gulp-cli'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/share/nodejs/gulp/bin/gulp.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Cause: File permission issue. I ran the same with sudo permissions and it ran successfully.

Can you check if the directories that are being accessed for the modules have relevant permissions ?

ps2goat commented 3 years ago

I had a similar issue with something not being able to find module 'node', with a similar stack trace as everyone else (cjs/loader).

The Angular app worked; Angular tests worked on Mac but did not work on Windows. To get it working on Windows, I had to uninstall the versions of our testing suite, then reinstall them to get the latest versions. (mocha, chai, their @types, and nyc, if that helps anyone.)

Both Mac and Windows machines were on Node 10.19