Cannot find module 'semver' When installing Npm - node.js

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.

Related

Error: Cannot find module 'binary-extensions'

I am trying to use reactjs on local system.
I followed the official documentation of reactjs and was trying its tutorial on tic tac toe.
For local development environment I followed all the steps but when I try to run npm start I am getting below error
module.js:549
throw err;
^
Error: Cannot find module 'binary-extensions'
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> (/home/Documents/my-
app/node_modules/chokidar/node_modules/is-binary-path/index.js:3:24)
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 am using Node v8.11.3 and npm v5.6.0
FYI I have installed binary-extensions using npm i binary-extensions but I am still getting same error.
Somehow, your project has lost track of the binary-extensions module.
The fix is simple.
In your project, delete node_modules/
macOS / Linux:
rm -rf node_modules/
Windows:
rmdir node_modules/
Then,
npm install
This will resolve the issue.

npm Error: Cannot find module 'core-util-is'

When I run
npm -v, npm install and npm install --save react-native-voice
this error appears:
module.js:549
throw err;
^
Error: Cannot find module 'core-util-is'
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> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:67:12)
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)
this solution solve my problem
1- i run this command
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
2- i install node.js again
3- i run
npm install
and now every thing is ok.
I had a same issue, but finally figured it why this is happening...
Solution
Remove npm and npm-cache folder from users/yourName/Appdata/Roaming.
then remove node completely from your computer.
restart
Now, reinstall node.js using msi installer .
done.

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

npm cannot run in Debian: Error: Cannot find module 'node-uuid'

Not really good with this JavaScript world. Trying to install npm and I think it's broken. I'm using Debian and ran:
apt install npm.
Everything went fine but when I run npm it throws up this error
module.js:538
throw err;
^
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/request/index.js:29:12)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Nothing works, i can't install the node-uuid either.
I fixed this, I think there's a problem with the package on Debian repo.
I followed the instruction on Node website
https://nodejs.org/en/download/package-manager/
I have npm installed now :)

Nodejs: Cannot find module npmlog

i'm trying to install gulp but it's showing Error:
current version :v4.3.1
Error: Cannot find module 'npmlog'
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 C:\Users\achraf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:20:13
at Object.<anonymous> (C:\Users\achraf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:76:3)
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)
C:\Users\achraf\AppData\Roaming\npm is the path for global installed modules, so if I have to guess, your global installed npm is not up to date. Try to remove the global installed npm and use the built in version, that comes with the node installer. To remove the global installed npm delete the npm and npm.cmd files in C:\Users\achraf\AppData\Roaming\npm and the folder npm in C:\Users\achraf\AppData\Roaming\npm\node_modules.

Resources