npm -v throws 471 error cannot find module.js - node.js

i recently installed node 6.9.2 on my PC and it is working fine but when i check npm using npm -v, i throws a module.js:471 throw err. cannot find module C:\Users\MyUser\*.
I already tried re-installing node and git, setting environment variable paths, and removing node_modules. I've been searching the internet for a couple of days now but i have no luck. I would really appreciate some help.
thanks in advance.

Related

What can I do to solve the npm "Cannot find module 'util-deprecate'" error?

While install a module using NPM, this error showed up.
**
Error: Cannot find module 'util-deprecate'
**
I uninstalled and reinstalled the entire Node.js but every attempt to install modules using NPM was futile and every time same error keeps popping up.
Windows 10 with latest Node.js 12.18.3
Ok, I resolved the issue myself.
While updating the NPM using command line, the update crashed and many files within the C:\Users\UserName\AppData\Roaming\npm\node_modules\npm\node_modules were deleted.
Solution would be to copy the missing modules from Node Modules within npm of Node Js directory in Program Files (Windows). It will work for sure.
Thank you.
Install NVM and use the correct version of Node.JS
https://github.com/nvm-sh/nvm
~ nvm usw 11
Solved the OP's error for me.

Npm not installed?

I recently downloaded node.js from nodejs.org and installed it correctly on windows, from gitbash. I ran node -v, it gave me a version number, but when I ran npm -v, I get bunch of error message like these;
Internal/module/cjs/loader.js:330 Throw err;
Error: cannot find module 'C:\Program
Files\nodejs\node_modules\npm\node_modules\nom-registry-fetch\node_modules\fighy-pudding\index.js'.
Please verify that the package.json has a valid "main" entry
And other bunch of errors...
How do I fix these, please
Npm is distributed with Node.js- which means that when you download Node.js, you automatically get npm installed on your computer. If it's not working in your case then try again or you need to install npm separately.
For installing you can follow the blog:-
https://phoenixnap.com/kb/install-node-js-npm-on-windows
OR
You can download the same from:-
https://nodejs.org/en/download/
I hope it would help!

Npm not installed

I recently downloaded node.js from nodejs.org and installed it correctly on windows, from gitbash I ran node -v,it gave me a version number,but when I ran npm -v, I get bunch of error message like these;
Internal/module/cjs/loader.js:330
Throw err;
Error: cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\nom-registry-fetch\node_modules\fighy-pudding\index.js'.
Please verify that the package.json has a valid "main" entry
And other bunch of errors...
How do I fix these please
Well, i tried alot of replies, still ended up the same.
I reinstalled windows and installed the same nodejs.exe i downloaded and npm was installed...lol

Why isn't Node.js coming with NPM when installed?

I downloaded Node.js via https://nodejs.org/en/ and installed it successfully. In Terminal, I ran the command node -v which then gives me v11.2.0 indicating that Node.js is indeed installed.
However, upon running npm -v I get an error that says: -bash: npm: command not found. I've looked at everything online, tried everything I possibly could but no luck at all.
It's very frustrating because it said that npm comes with node but it looks like it doesn't.
How can I fix this?
Edit: I'm on Mac

Could not find module 'json-schema' while installing angular cli using npm

I am getting this error:
I am not able to install the angular cli using npm. I am getting the "cannot find module 'json-schema'" error. I tried reinstalling the node js and npm with the latest versions. But the error didn't resolve. Please help me with this.
This issue has a fix in the link below:
https://github.com/kriszyp/json-schema/issues/29
Good Luck
I uninstalled and installed node/npm/angular-cli many times. Finally did a "where ng" on my windows pc, and found the executable was under the %appdata%\npm directory. So after uninstalling node, deleting the %appdata%\npm directory, reinstalling node, and 'npm install -g angular-cli', the ng new and ng serve commands started working.

Resources