Tag Archives: npm -v

After installing nodejs, running NPM – V will cause (module. JS: 339 throw err..) error. Solution

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