What is module.js 540 throw error? - node.js

Just installing node/npm first time, Linux Fedora: I've followed all the instructions and tried every fix I can find on google.
Whenever I try to run npm install or npm test I get this:
module.js:540
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at /usr/lib/node_modules/npm/bin/npm-cli.js:22:13
at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)

It was a bug and it has already been fixed in Node v5.4.1. Now it's working as usual.

Related

Cannot find module 'mongoose' even though it exists

I am trying to run my node file but it gives me an error saying "Cannot find module 'mongoose'". I checked, I have mongoose in the node modules folder already. I have already tried deleting node module, packagelock.json and running npm install. I also tried downloading mongoose globally and linking them. None of them seem to work.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'mongoose'
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.<anonymous> (/mnt/c/Users/Ahsim Shakya/Desktop/LoginPage/database/models/userDetails.js:1:18)
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.<anonymous> (/mnt/c/Users/Ahsim Shakya/Desktop/LoginPage/server/server.js:11:20)
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)
had the same issue and this worked for me
rm -rf node_modules
npm install -g npm#latest
npm i core-util-is

Throw error whenever attempting to use geoproject command in terminal

I keep getting the same error anytime I try to use the geoproject command.
I have the latest version of node and D3 downloaded.
error message:
Parkers-MacBook-Pro-2:proj parkerbarton$ geoproject
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'resolve'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/local/lib/node_modules/d3-geo-projection/bin/resolve.js:2:15)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
tldr; Just re-install to get the new version of d3-geo-projection.
npm install -g d3-geo-projection
There's an issue for this here: https://github.com/d3/d3-geo-projection/issues/161
And there's a fix for this up on a pull request, but it hasn't gotten pulled in yet. You could wait for the fix or in the meantime you can probably just add 'require' into the same place in {global-install-location}/node_modules/d3-geo-projection/package.json
https://github.com/d3/d3-geo-projection/pull/162/commits/43105df62b784f0645cb3d4cb0b0fa98c8924c87
UPDATE: It's up on 2.6, just re-install d3-geo-projection.

Node.Js - NPM - Error: Cannot find module 'umask' in Windows 10

I installed Node.JS 64x version 8.10.0 in windows 10. And everytime I use npm command in "cmd" always got this error. I tried this solution but still has the same error, topic: "error cannot find module 'umask'". Does anyone has a clue? Thank you very much.
C:\WINDOWS\system32>npm --version
module.js:549
throw err;
^
Error: Cannot find module 'umask'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\ProgramData\Microsoft\VisualStudio\MDA\3702e81b\taco-toolset-6.3.1\node_modules\npm\lib\utils\umask.js:1:75)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

My npm command does not work "Cannot find module 'internal/errors'"

My npm command does not work anymore I uninstall and re install nodejs many times and still getting the same issue, so here is my console output, how can I fix this?
C:\Users\pirat>npm install
module.js:529
throw err;
^
Error: Cannot find module 'internal/errors'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at evalmachine.<anonymous>:36:16
at Object.<anonymous> (C:\Users\pirat\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
C:\Users\pirat>
I re-install node version 6.11 and updated npm now is all working :)

Updating node.js possibly lead to npm error

I recently updated the node.js to the version 6.11.1. Got an error when accessing npm
When I tried to check the version of npm, the following error occurs
$ npm -v
module.js:471
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:92:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
After getting this error I updated the node.js to the latest version 8.1.4.
and the error is same with different line numbers.
$ npm -v
module.js:487
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:92:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
What is happening? Any fix to this issue?
At last, I got the solution.
I have copied all contents from
C:\Program Files\nodejs\node_modules\npm
and pasted it in
C:\Users\dino\AppData\Roaming\npm\node_modules\npm

Resources