6

Upgraded to Node 5.4.0 via 'brew upgrade,' and then ran 'npm update -g,' which upgraded to npm 3.5.4. npm update finished with warnings:

/usr/local/lib
└── npm@3.5.4

npm WARN EBUNDLEOVERRIDE Replacing bundled npm > init-package-json with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > node-gyp with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npm-install-checks with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npmlog with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > read-package-json with new installed version

Running 'npm update -g' (or any other npm command) now throws npmlog errors:

module.js:328
    throw err;
    ^

Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:20:13
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:76:3)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)

It's not clear to me why the override is happening, or how to point npm to the logs again. Appreciate any thoughts.

  • I'm having the same issue (but I didn't upgrade node, just ran the global update). Found this googling for the error message and `Replacing bundled npm > npmlog with new installed version`. [Only answer I can find](http://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x) is to completely uninstall and reinstall npm. What a pain. – Brynn Bateman Jan 10 '16 at 19:15
  • Discussion with the npm devs seems to indicate that the issue has to do with the prior version of npm (3.3.12 with a fresh Homebrew install, or 3.4.x, but apparently not a problem with 3.5.x updating to 3.5.4). Complete uninstall will only work until the next time you 'npm update -g,' and npm is updated to latest. Main fix will be when Homebrew version of node updates its npm to 3.5.x I believe/hope. – Dusty Pomerleau Jan 11 '16 at 02:23

2 Answers2

1

Looks like brew reinstall node is the least-destructive way to resolve this. Will install node 3.3.12 while leaving everything else in place:

$ brew reinstall node
==> Reinstalling node
==> Downloading https://homebrew.bintray.com/bottles/node-5.4.1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/node-5.4.1.yosemite.bottle.tar.gz
==> Pouring node-5.4.1.yosemite.bottle.tar.gz
==> Caveats
Please note by default only English locale support is provided. If you need
full locale support you should:
  `brew reinstall node --with-full-icu`

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
  /usr/local/Cellar/node/5.4.1: 2,827 files, 34.2M

$ npm outdated --global
Package  Current  Wanted  Latest  Location
npm       3.3.12   3.5.4   3.5.3
Chris
  • 348
  • 3
  • 9
  • Thanks Chris - this is a great temporary fix, but as long as npm is managing itself, running 'npm update -g' will reintroduce the problem. I suppose one could avoid updating globally until the node package has npm 3.5.x, but that could take a while. I may need to simply leave Homebrew behind on this one and install node/npm directly at the current version (with or without a version manager). That would skip over the upgrade from 3..3.12 and presumably resolve the issue. – Dusty Pomerleau Jan 16 '16 at 02:14
  • @Dusty Looks like homebrew is now serving `node 5.4.1_1` which comes with `npm 3.5.3`. I was able to then `npm update -g` to `npm 3.5.4` which seems to have worked. – Chris Jan 17 '16 at 04:06
  • 1
    Outstanding - this works for me as well. Thanks for taking the time to follow up! – Dusty Pomerleau Jan 17 '16 at 07:07
  • I'm having this issue when trying to deploy our app to a Heroku instance that does not have brew installed. Is the guidance to try to install brew on the Heroku dyno, or does anyone know of an alternate fix? Thanks! – Stoph Mar 14 '16 at 16:43
0

I completely reinstalled npm which seemed to be the only solution I could find for this error. It fixed it for me.

Community
  • 1
  • 1
Brynn Bateman
  • 689
  • 6
  • 22
  • Complete uninstall followed by 'brew install node' yields npm v. 3.3.12. This version works. Subsequently running 'npm update -g' yields npm v. 3.5.4, with the same EBUNDLEOVERRIDE and errors I described. The problem seems to be specific to this version of npm. – Dusty Pomerleau Jan 11 '16 at 01:33
  • I guess the difference is I'm not using brew, I reinstalled using npm/n. And no plans to try a global update again, hah. – Brynn Bateman Jan 11 '16 at 02:41