This repository has been archived by the owner. It is now read-only.

cannot find module 'npmlog' - after updated npm #20323

enriquerene opened this Issue Apr 12, 2018 · 4 comments


None yet
5 participants

enriquerene commented Apr 12, 2018

I'm opening this issue because:

  • [ x ] npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • npm is producing incorrect or undesirable behavior.
  • Other (see below for feature requests):

What's going wrong?

After I run "npm install -g npm" for any command using "npm" I get back
throw err;

Error: Cannot find module 'npmlog'
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 /usr/lib/node_modules/npm/bin/npm-cli.js:22:13
at Object. (/usr/lib/node_modules/npm/bin/npm-cli.js:92:3)
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)`

I'm using Linux Fedora 27

How can the CLI team reproduce the problem?

supporting information:

  • npm -v prints: the above error message
  • node -v prints: v8.11.0
  • npm config get registry prints: the above error message
  • Windows, OS X/macOS, or Linux?: Linux Fedora 27

This comment has been minimized.

enriquerene commented Apr 13, 2018

I think I did a workaround:

First I uninstall Node.js (I'm using Fedora 27, I just used dnf instead apt-get) -

Install NVM -

After these steps I got node -v returning v9.11.1 and npm -v returning 5.6.0 (which I'm afraid to update to 5.8.0 again - that triggered the issue)

Installed @angular/cli again and it seems everything is fine.

@KenanY KenanY added the support label Apr 14, 2018


This comment has been minimized.

metamezzo commented Apr 25, 2018

I did a similar workaround as @enriquerene when I encountered the same problem on my Win 10 PC.

I just did 'npm i -g npm' when prompted by npm that an update is available (5.6.0 -> 6.0.0). Afterwards, all npm commands return the same message as reported above.


  1. Uninstall Node.js either using the *.msi installer from or via Control Panel > Programs and Features
  2. Delete or rename the 'npm' folder under %PROGRAMFILES%\nodejs\node_modules
  3. Reinstall Node.js using the *.msi installer
  4. node -v returns the correct Node version (eg v8.11.1) and npm -v returns 5.6.0

This comment has been minimized.

Scombr0 commented May 11, 2018

I had the same problem as you @metamezzo, but your workaround needed a little tweak.

I don't know why folder 'C:\Users\<user>\AppData\Roaming\npm' kept there after uninstalling, and this record 'C:\Users\<user>\AppData\Roaming\npm' was in my PATH Enviroment Variables.

So my steps were:

  1. Uninstall as you said.
  2. I didn't have that folder you say when I uninstalled, but instead I still had 'C:\Users\<user>\AppData\Roaming\npm', so I deleted it. I also deleted that record from my PATH in my Enviroment Variables.
  3. Same
  4. Same

Now I get the npm -v working correctly.


This comment has been minimized.

phod commented Jun 14, 2018

I've encountered a similar issue. My use-case included docker, so steps to reproduce (without adding too much additional configuration) are:

  1. $ docker run -it --entrypoint /bin/bash node:8
  2. $ npm i npm -g
  3. $ npm --version # Now broken

NPM before updating was: npm 5.4.2

NPM after updating is: npm 5.10.0

EDIT: Seems my specific issue is partially solved here: #16807 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.