Npm command doesn't work anymore - node.js

Whenever I try to run the npm command I end up with the following:
module.js:327
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\decraejo\AppData\Roaming\npm\node_modules\npm\node_modules\npmlog\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
I found this article, but their solution doesn't seem to work for me:
https://github.com/npm/npm/issues/6366
#deepakvasa Very helpful advice! I've also met with this problem and solve it by remove node_modules and reinstall npm
Where should I remove the node_modules from?

For me, this was due to an incorrect installation attempt of npm that I had attempted. Just go to: "drive_name":\Users\"your_user_name"\AppData\Roaming\npm and remove the node_modules folder. Then try again. Did it for me!
Cheers!

Related

Cannot find module './driver'

when i run my project in nodejs i get this error:
Error: Cannot find module './driver'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
please someone can help me!
Probably this is npm related problem. Try to delete node_modules and package-lock.json and run npm install.
If above solution doesn't work for you, try to use yarn rather than npm, which I did when I had this problem.

Cannot find module 'semver' When installing Npm

This is the error i got when try to install npm.
please help me to fix it.
module.js:549
throw err;
^
Error: Cannot find module 'semver'
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:\Users\maheshig\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js:2:14)
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)
I followed These steps and it solved my issue
uninstall Node.js
Remove the content of the following folders
C:\Users\AppData\Roaming\npm-cache
C:\Users\AppData\Roaming\npm
C:\Program Files\nodejs
Then again install Node https://nodejs.org/en/
In linux you can use the following
sudo rm -rf /usr/lib/node_modules/
or wherever your global node_modules are
then reinstall npm
this solved the problem with me.

How to solve ini error for npm

I just install node.js to my system. My node version is v8.10.0. When I try npm -v I get following error.
module.js:549
throw err;
^
Error: Cannot find module 'ini'
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:\Users\ai8\AppData\Roaming\npm\node_modules\npm\node_modules\config-chain\index.js:4:11)
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)
How can I fix this issue?
I had a same kind of issue before. I tried all the solutions even tried uninstalling and reinstalling node js. Finally, I tried by removing the node_modules from the user folder.
Then, run npm install.
This worked for me.
Hope it works for you
delete node_modules and reinstall
rm -rf node_modules
npm install
Use this link for further details. Hope this will help you.
npm

node.js terminal error. (MAC)

I've downloaded node.js and have already checked if it's installed by typing node -vinto the terminal. I already found a question which was almost the same as mine, but their answer didn't work at all.
Anyways, my problem is that I can't get .js files to open with node.js. When I type node automatic.js it responds with this (I put #FULLNAME instead of my actual full name):
Maxs-MBP-2:desktop #FULLNAME#$ node automatic.js
module.js:327
throw err;
^
Error: Cannot find module './app/logging.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/#FULLNAME#/Desktop/automatic.js:1:73)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
I'm sorry if this is actually an easy fix, I'm new to all of this. This is also my first post on Stackoverflow. Hello, world! Thank you so much!
~Max

gulp dev cant be run because of mistake

I run npm install in the project's root and then when I try to run gulp de, I get the following mistake:
$ gulp dev
module.js:442
throw err;
^
Error: Cannot find module './lib/public/public-utils'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\ente\node_modules\browser-sync\index.js:9:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\ente\gulpfile.js:27:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
at Liftoff.<anonymous> (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js :193:16)
at module.exports (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\flagged- respawn\index.js:17:3)
at Liftoff.<anonymous> (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js:185:9)
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js: 159:9
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:108:14
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:36:12
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:47:7
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3
the gulp file
i tried different things, like to go to an older node, to the latest one, reinstalled node, npm and gulp billions of times, but it didnt help.
What can it be and how to fix it?
The error seems to happen when you require the browser-sync module in your gulpfile. The module doesn't find one of it's own components ./lib/public/public-utils and can't start.
I'd first check in your node_modules directory to see what's going on with browser-sync.
It's usually a corrupted install of the module.
Make sure that in your package.json you have browser-sync listed with the most up-to-date version (2.13.0) and to get a fresh install delete your node_modules directory, npm cache clean
and run npm install again.

Resources