Introduction: Recently, after installing nodejs, I ran node -v on windows cmd without any problems, and was dumbfounded when I typed npm -v and came up with the following series of errors shown below:
Error: Cannot find module ‘npmlog’ at Function.Module._resolveFilename
(module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:18:11
at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:75:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
When installing plugins such as express, the system will install to the default path (unless you have set the path) under windows is C:\Users\jerry\AppData\Roaming
Solution:
windows
rmdir %appdata%\npm\node_modules /s /q
Unix or Linux
rm -rf /usr/local/bin/node_modules
Similar Posts:
- [Solved] Nodejs Error: Cannot find module ‘express’
- Completely Uninstall Node.js from Mac OS X
- Module build failed: Error: Cannot find module ‘node-sass’
- [Solved] NPM installation Vue scaffold error: npm ERR! Unexpected end of JSON input while parsing near…
- Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 7.x
- [Solved] NPM downloads the dependency of the front-end Vue admin template master template Error
- [Solved] Module build failed: Error: Cannot find module ‘node-sass’
- Solution to the failure of node rdkafka in docker build
- How to Solve Error: ENOENT: no such file or directory, scandir ‘..\node_modules\node-sass\vendor’
- How to Solve Error: Cannot find module ‘gulp-sass’