nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 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
yathamravali commented 5 years ago

@subhrajitroy1989 Try rm -rf node_modules npm install -g npm@latest npm i core-util-is

Sruth8 commented 5 years ago

Does anyone know if this works. I'm getting the same problem.

Sruth8 commented 5 years ago

I just did the steps above and I'm still getting the error. What should I do next.

yathamravali commented 5 years ago

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

leovdev commented 5 years ago

@Sruth8 It worked for me.

jluisborjon commented 5 years ago

It worked! Thanks

pansuriyaravi commented 5 years ago

getting same error when i run express server through node main.js

package.json { "name": "app", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "start:web": "node web/dist/bundle.js", "test": "jest", "build:dev": "rm -rf web/dist web/public && webpack --mode=development", "build:pro": "rm -rf web/dist web/public && webpack --mode=production", "serve:pro": "rm -rf web/dist web/public && webpack-dev-server --mode=production --hot", "serve:dev": "rm -rf web/dist web/public && webpack-dev-server --mode=development --hot", "desktop": "electron ." }, "dependencies": { "react": "16.8.3", "react-dom": "^16.8.6", "react-native": "^0.59.8", "react-native-web": "^0.11.2" }, "devDependencies": { "@babel/core": "^7.4.4", "@babel/preset-env": "^7.4.4", "@babel/preset-react": "^7.0.0", "@babel/runtime": "^7.4.4", "babel-jest": "^24.8.0", "babel-loader": "^8.0.5", "css-loader": "^2.1.1", "express": "^4.16.4", "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", "jest": "^24.8.0", "metro-react-native-babel-preset": "^0.54.0", "react-test-renderer": "16.8.3", "style-loader": "^0.23.1", "webpack": "^4.31.0", "webpack-cli": "^3.3.2", "webpack-dev-server": "^3.3.1", "webpack-node-externals": "^1.7.2" }, "jest": { "preset": "react-native" } }

error=>

node web/dist/bundle.js

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

Error: Cannot find module 'warnOnce' 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. (/home/ravi/Documents/practice/node/react/Cross-Platefrorm (copy)/app/node_modules/react-native/Libraries/react-native/react-native-implementation.js:14:18) 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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! app@0.0.1 start:web: node web/dist/bundle.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the app@0.0.1 start:web 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! /home/ravi/.npm/_logs/2019-05-18T17_15_13_253Z-debug.log

emirom commented 5 years ago

use this method to remove npm and node: https://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows

then install nodejs LTS from nodejs.org

prasannaballal commented 5 years ago

@subhrajitroy1989 npm i core-util-is

doing this only worked for me.

gireeshpunathil commented 5 years ago

@subhrajitroy1989 - is this resolved?

radurentea commented 5 years ago

What worked for me is to make sure the webpack-dev-server is up to date, so run the following command: npm install webpack-dev-server

gireeshpunathil commented 5 years ago

resolved, closing

mtarun15 commented 5 years ago

Tried each and everything mentioned here but nothing is working out.

npm ERR! path /home/tarunmanchukonda/package.json

npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '/home/tarunmanchukonda/package.json' npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! /home/tarunmanchukonda/.npm/_logs/2019-07-19T12_54_53_629Z-debug.log

maakireddymaheswarReddy commented 5 years ago

Does anyone know if this works. I'm getting the same problem.

body-parser type like this then it works

rspixers commented 5 years ago

I'm getting an error like this

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

Error: Cannot find module './paths' 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:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\Users\Prashanth\Desktop\React\react-boilerplategit\config\webpack/webpack.common.babel.js:4:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Module._compile (C:\Users\Prashanth\Desktop\React\react-boilerplategit\node_modules\pirates\lib\index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Object.newLoader [as .js] (C:\Users\Prashanth\Desktop\React\react-boilerplategit\node_modules\pirates\lib\index.js:104:7) at Module.load (internal/modules/cjs/loader.js:653:32)

These are my Dev Dependencies: "devDependencies": { "@babel/cli": "7.4.3", "@babel/core": "7.4.3", "@babel/node": "7.2.2", "@babel/plugin-proposal-class-properties": "7.3.0", "@babel/plugin-proposal-object-rest-spread": "7.3.1", "@babel/plugin-syntax-dynamic-import": "7.2.0", "@babel/plugin-syntax-import-meta": "7.2.0", "@babel/plugin-transform-async-to-generator": "7.2.0", "@babel/plugin-transform-runtime": "7.2.0", "@babel/preset-env": "7.3.1", "@babel/preset-react": "7.0.0", "@babel/register": "7.0.0", "@babel/runtime": "7.3.1", "babel-core": "7.0.0-bridge.0", "babel-eslint": "10.0.1", "babel-jest": "24.0.0", "babel-loader": "8.0.4", "clean-webpack-plugin": "^1.0.1", "core-js": "3", "css-loader": "^2.1.0", "cypress": "^3.1.4", "eslint": "^5.12.1", "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.0.0", "eslint-loader": "^2.1.1", "eslint-plugin-babel": "^5.3.0", "eslint-plugin-import": "^2.15.0", "eslint-plugin-jsx-a11y": "^6.2.0", "eslint-plugin-prettier": "^3.0.0", "eslint-plugin-react": "^7.12.4", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", "husky": "^1.2.0", "img-loader": "^3.0.1", "jest": "^24.0.0", "jest-dom": "^3.0.1", "node-sass": "^4.10.0", "postcss-loader": "^3.0.0", "prettier": "^1.16.1", "react-testing-library": "^7.0.1", "redux-logger": "^3.0.6", "sass-loader": "^7.1.0", "style-loader": "^0.23.1", "url-loader": "^1.1.2", "webpack": "^4.32.0", "webpack-cli": "^3.3.4", "webpack-dev-server": "^3.7.2", "webpack-jarvis": "^0.3.2", "webpack-merge": "^4.2.1" }, "dependencies": { "core-util-is": "^1.0.2", "cross-env": "^5.2.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-redux": "^7.1.0", "react-router-dom": "^5.0.1", "redux": "^4.0.1", "redux-thunk": "^2.3.0", "styled-components": "^4.3.1" }

abu-bakarr commented 5 years ago

i need help

[nodemon] 1.18.9 [nodemon] to restart at any time, enter rs [nodemon] watching: . [nodemon] starting node ejs, js, json app internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module 'bcrypt' 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:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\Users\Lovel\Desktop\Greenta-Collect-App\app\routes\adminRoutes.js:4:16) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\Users\Lovel\Desktop\Greenta-Collect-App\app.js:152:21) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) [nodemon] app crashed - waiting for file changes before starting...

JakeGreer commented 5 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"

pansuriyaravi commented 5 years ago

I'm getting an error like this

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

Error: Cannot find module './paths' 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:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\Users\Prashanth\Desktop\React\react-boilerplategit\config\webpack/webpack.common.babel.js:4:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Module._compile (C:\Users\Prashanth\Desktop\React\react-boilerplategit\node_modules\pirates\lib\index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Object.newLoader [as .js] (C:\Users\Prashanth\Desktop\React\react-boilerplategit\node_modules\pirates\lib\index.js:104:7) at Module.load (internal/modules/cjs/loader.js:653:32)

These are my Dev Dependencies: "devDependencies": { "@babel/cli": "7.4.3", "@babel/core": "7.4.3", "@babel/node": "7.2.2", "@babel/plugin-proposal-class-properties": "7.3.0", "@babel/plugin-proposal-object-rest-spread": "7.3.1", "@babel/plugin-syntax-dynamic-import": "7.2.0", "@babel/plugin-syntax-import-meta": "7.2.0", "@babel/plugin-transform-async-to-generator": "7.2.0", "@babel/plugin-transform-runtime": "7.2.0", "@babel/preset-env": "7.3.1", "@babel/preset-react": "7.0.0", "@babel/register": "7.0.0", "@babel/runtime": "7.3.1", "babel-core": "7.0.0-bridge.0", "babel-eslint": "10.0.1", "babel-jest": "24.0.0", "babel-loader": "8.0.4", "clean-webpack-plugin": "^1.0.1", "core-js": "3", "css-loader": "^2.1.0", "cypress": "^3.1.4", "eslint": "^5.12.1", "eslint-config-airbnb": "^17.1.0", "eslint-config-prettier": "^4.0.0", "eslint-loader": "^2.1.1", "eslint-plugin-babel": "^5.3.0", "eslint-plugin-import": "^2.15.0", "eslint-plugin-jsx-a11y": "^6.2.0", "eslint-plugin-prettier": "^3.0.0", "eslint-plugin-react": "^7.12.4", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", "husky": "^1.2.0", "img-loader": "^3.0.1", "jest": "^24.0.0", "jest-dom": "^3.0.1", "node-sass": "^4.10.0", "postcss-loader": "^3.0.0", "prettier": "^1.16.1", "react-testing-library": "^7.0.1", "redux-logger": "^3.0.6", "sass-loader": "^7.1.0", "style-loader": "^0.23.1", "url-loader": "^1.1.2", "webpack": "^4.32.0", "webpack-cli": "^3.3.4", "webpack-dev-server": "^3.7.2", "webpack-jarvis": "^0.3.2", "webpack-merge": "^4.2.1" }, "dependencies": { "core-util-is": "^1.0.2", "cross-env": "^5.2.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-redux": "^7.1.0", "react-router-dom": "^5.0.1", "redux": "^4.0.1", "redux-thunk": "^2.3.0", "styled-components": "^4.3.1" }

try removeing style-loader, that helped me with my server side rendering

yourwpmadesimple commented 5 years ago

@subhrajitroy1989 , My brother from a different mother. Thank you, man!

qureshitauqeer3 commented 5 years ago

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

Error: Cannot find module 'C:\Users\admin'\ScrapeExample.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:829:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

shanmicheal25 commented 5 years ago

{ "name": "app", "main": "server.js", "dependencies": { "bcrypt": "^3.0.6", "body-parser": "^1.19.0", "cron-parser": "^2.10.0", "cronstrue": "^1.65.0", "dateformat": "^3.0.3", "dotenv": "^7.0.0", "express": "^4.17.0", "fs": "0.0.1-security", "http": "0.0.0", "https": "^1.0.0", "jsonwebtoken": "^8.5.1", "lokijs": "^1.5.6", "mariadb": "^2.0.5", "node-cron": "^2.0.3", "request": "^2.88.0", "sftp-upload": "^1.0.1", "ssh2-sftp-client": "^2.5.0", "ssl-root-cas": "^1.3.1" }, "scripts": { "start": "nodemon --ignore public/data --ignore db -r dotenv/config server.js" }, "devDependencies": { "nodemon": "^1.19.1" } }

shanmicheal25 commented 5 years ago

I facing the same problem.

hubcelab commented 5 years ago

All you need to do is

npm install -g @angular/cli

Courtesy: Marshian Santhosh https://www.hubcelab.com

OlatunjiGab commented 5 years ago

ionic-app-scripts.cmd build --target cordova --platform android [20:28:37] ionic-app-scripts 3.2.4 [20:28:38] build dev started ... [20:28:39] clean started ... [20:28:42] clean finished in 2.80 s [20:28:42] copy started ... [20:28:52] deeplinks started ... [20:28:52] deeplinks finished in 895 ms [20:28:53] transpile started ... [20:30:06] transpile finished in 73.12 s [20:30:06] preprocess started ... [20:30:06] preprocess finished in 343 ms [20:30:07] webpack started ... [20:32:48] webpack finished in 161.67 s [20:32:49] sass started ... [20:34:00] sass finished in 71.63 s [20:35:13] copy finished in 391.25 s [20:35:14] postprocess started ... [20:35:17] postprocess finished in 3.64 s [20:35:18] lint started ... [20:35:25] build dev finished in 407.58 s [20:38:48] lint finished in 210.07 s

cordova.cmd build android internal/modules/cjs/loader.js:584 throw err; ^

Error: Cannot find module 'update-notifier' 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. (C:\Users\Gabriel\Documents\GabFile\MyProject\Book-Store\node_modules\cordova\src\cli.js:20:22) 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) [ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

This error has been delaying my job any help pls, It works fine on the browser but any time i want to deploy on device it throws this error

Harizriz commented 4 years ago

I want to run my Vue.js using npm on localhost:8080 but they give me this error. Is there a way to solve this issue?

This error only occurs when I tried to install node_modules and package-lock.json in my Vue folder containing .babelrc, package.json and webpack.config.js. For my other Vue folders, I still can run my localhost:8080 by using the same method for all folders which is

npm install
npm run dev

The code below is the Error.

The system cannot find the path specified.
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'C:\Users\acer\Documents\VueJs\cross-env\dist\bin\cross-env.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-cli@ dev: `cross-env NODE_ENV=development webpack-dev-server --open --inline --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-cli@ dev 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!     C:\Users\acer\AppData\Roaming\npm-cache\_logs\2019-08-26T02_18_38_374Z-debug.log
thebadasscoder commented 4 years ago

@subhrajitroy1989 Try rm -rf node_modules npm install -g npm@latest npm i core-util-is

Thanks this worked for me!

Achala03 commented 4 years ago

Getting error .Working on Laravel-mix and react

E:\startupwala-website>npm run watch -poll

startupwala-website@1.0.0 watch E:\startupwala-website npm run development -- --watch

startupwala-website@1.0.0 development E:\startupwala-website cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

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

Error: Cannot find module 'webpack/lib/RuleSet' 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. (E:\startupwala-website\node_modules\vue-loader\lib\plugin.js:2:17) 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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! startupwala-website@1.0.0 development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the startupwala-website@1.0.0 development 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! C:\Users\Achala\AppData\Roaming\npm-cache_logs\2019-09-05T12_39_53_335Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! startupwala-website@1.0.0 watch: npm run development -- --watch npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the startupwala-website@1.0.0 watch 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! C:\Users\Achala\AppData\Roaming\npm-cache_logs\2019-09-05T12_39_53_398Z-debug.log

Achala03 commented 4 years ago

Windows 10 Laravel-mix React

I Tried below cmd but still getting errors ....

rm -rf node_modules npm install -g npm@latest npm i core-util-is

E:\startupwala-website>npm run watch -poll

startupwala-website@1.0.0 watch E:\startupwala-website npm run development -- --watch

startupwala-website@1.0.0 development E:\startupwala-website cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

E:\startupwala-website\webpack.mix.js:10 mix.disableNotifications(); ^

TypeError: Cannot read property 'disableNotifications' of undefined at Object. (E:\startupwala-website\webpack.mix.js:10:5) 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) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (E:\startupwala-website\node_modules\laravel-mix\setup\webpack.config.js:12: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) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! startupwala-website@1.0.0 development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the startupwala-website@1.0.0 development 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! C:\Users\Achala\AppData\Roaming\npm-cache_logs\2019-09-05T13_16_02_205Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! startupwala-website@1.0.0 watch: npm run development -- --watch npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the startupwala-website@1.0.0 watch 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! C:\Users\Achala\AppData\Roaming\npm-cache_logs\2019-09-05T13_16_02_354Z-debug.log

chavychaze commented 4 years ago

I had installed @nestjs/cli globally, so delete manually folder and reinstalling it works for me

katrinanova commented 4 years ago

also solved internal/modules/cjs/loader.js throw err; ==> Cannot find module './codes.json'

vperaltac commented 4 years ago

npm i core-util-is fixed it for me.

ZpeedTube commented 4 years ago

My error was:

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

Error: Cannot find module 'theFilePath'

I think I had some other error number at some point also.

Using: Win 10 nodejs v10.16.3 typescript, express, mongoose, (more modules that are not relevant)

Scenario: I was trying to use a file outside src folder. When compiling and trying to run I got that error.

My solution was: I moved the file from outside src in to the src folder and the error was gone.

Hope this helps someone doing the same thing as me. 🙂

Zacknero commented 4 years ago

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

Error: Cannot find module 'C:\Users\admin'\ScrapeExample.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:829:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

How you solved it?? I have the same problem

QuentinIcky commented 4 years ago

Verify your hierarchy. I already had this issue, my server.js was in the wrong directory. Everything worked after

Zacknero commented 4 years ago

Verify your hierarchy. I already had this issue, my server.js was in the wrong directory. Everything worked after

server.js?? What's this file? But the scaffold is builded by nestjs-cli generator.

QuentinIcky commented 4 years ago

@Zacknero in your case I think ScrapeExample.js is the file corresponding to my server.js

Zacknero commented 4 years ago

@QuentinIcky i never created the ScrapeExample.js...this create the cli of nestjs....Because i don't find this on my pc :S :S

chavychaze commented 4 years ago

Mostly this error's occured when the nestjs wasn't installed correct globally, the best option to fix this, is try to reinstall it, in case, that after creating the file manually to fix one issue, you'll got to do it each time, when generating new modules with nest. Hope this help someone

Zacknero commented 4 years ago

Mostly this error's occured when the nestjs wasn't installed correct globally, the best option to fix this, is try to reinstall it, in case, that after creating the file manually to fix one issue, you'll got to do it each time, when generating new modules with nest. Hope this help someone

Ok but i have NVM, i deleted nvm node and re-installed but don't work

DhritishRoy commented 4 years ago

I am also having the same problem just like @Zacknero , the same error and I tried by reinstalling npm globally also I checked my directory also and the npm installed is also of latest version. Can someone kindly sort out this problem, will be a real help.

samayo commented 4 years ago

I solved my issue by removing single quotes ' from my package.json config.

ex, from

"scripts": {
 "dev": "webpack-dev-server --config './webpack.config.js'",

to

"scripts": {
 "dev": "webpack-dev-server --config ./webpack.config.js",

If this doesn't work, make sure your "main": {..} actually points to the main file, and delete node_modules/, package-lock.json and install everything npm i

Zacknero commented 4 years ago

ackage.jso

My package.json have this scripts:

"scripts": { "prebuild": "rimraf dist", "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "tslint -p tsconfig.json -c tslint.json", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json" }

I don't have your dev script, or must add it? Thanks!

samayo commented 4 years ago

Nah, dev is just an identifier to start the webpack dev server, in your case it is start:dev your should probably delete node_modules, package-lock.json and run npm i

Zacknero commented 4 years ago

Nah, dev is just an identifier to start the webpack dev server, in your case it is start:dev your should probably delete node_modules, package-lock.json and run npm i

Don't work

birender commented 4 years ago

Hi I am Facing Same Problem after install vue on command prompt npm install -g @vue/cli

Still vue not recognized by command prompt

Window 10 Home Edition

Thanks

dj-at-work commented 4 years ago

Had the same problem under macOS Catalina. A reinstall of the latest Node LTS version from (https://nodejs.org/de/download/) solved my problem.

ymkarthik commented 4 years ago

I have a similar problem while i am running a docker image

-> docker run my_hub_user_name/select internal/modules/cjs/loader.js:800 throw err; ^

Error: Cannot find module 'mysql' Require stack:

shubhsk88 commented 4 years ago

I am getting the same error while deploying my app to heroku while it was working perfectly fine on my computer

2020-01-04T18:29:12.996429+00:00 heroku[web.1]: Starting process with command `node server.js`
2020-01-04T18:29:15.402134+00:00 heroku[web.1]: Process exited with status 1
2020-01-04T18:29:15.419066+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-04T18:29:15.342265+00:00 app[web.1]: internal/modules/cjs/loader.js:800
2020-01-04T18:29:15.342286+00:00 app[web.1]: throw err;
2020-01-04T18:29:15.342288+00:00 app[web.1]: ^
2020-01-04T18:29:15.342291+00:00 app[web.1]: 
2020-01-04T18:29:15.342293+00:00 app[web.1]: Error: Cannot find module 'express'
2020-01-04T18:29:15.342295+00:00 app[web.1]: Require stack:
2020-01-04T18:29:15.342298+00:00 app[web.1]: - /app/server.js
2020-01-04T18:29:15.342300+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
2020-01-04T18:29:15.342302+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:690:27)
2020-01-04T18:29:15.342304+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:852:19)
2020-01-04T18:29:15.342307+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-01-04T18:29:15.342309+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:15)
2020-01-04T18:29:15.342311+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:959:30)
2020-01-04T18:29:15.342313+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2020-01-04T18:29:15.342316+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:815:32)
2020-01-04T18:29:15.342318+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2020-01-04T18:29:15.342320+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2020-01-04T18:29:15.342322+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-01-04T18:29:15.342324+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2020-01-04T18:29:15.342327+00:00 app[web.1]: }
kaaranRaahulS commented 4 years ago

What worked for me is to make sure the webpack-dev-server is up to date, so run the following command: npm install webpack-dev-server

This worked out well !

subhrajitroy1989 commented 4 years ago

Hi Guys,

If you have a project dependency on a particular version of npm, please don't update it. It's hectic to update the dependencies and resolve them one by one. So, it would be wise to uninstall the existing core-util.js which got corrupt. Please install the compatible core-util.js for the npm version and the issue will get resolved.

Thanks & Regards

Subhrajit Roy

On Thu, May 2, 2019, 11:03 AM Ravali Yatham notifications@github.com wrote:

@Sruth8 https://github.com/Sruth8 What's the node and npm version you are using? Please post the package-json

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/1846#issuecomment-488557644, or mute the thread https://github.com/notifications/unsubscribe-auth/AK3S7KPEJAH5YLYLQUZ4HJDPTJ4JBANCNFSM4HD5ZLXQ .