TypeError: Cannot read property '_' of undefined


After much work fixing up the file permissions and ACLs that the Chocolatey installer seems to have corrupted, I finally have 1.6 64-bit Meteor installed on WIndows 10 and able to compile and link my app. But I’m now getting this error:


 TypeError: Cannot read property '_' of undefined
     at packages\logging.js:7:28
     at packages\logging.js:490:3
     at infos.forEach.info (C:\Users\Ron\myApp\.meteor\local\build\programs\server\boot.js:414:13)
     at Array.forEach (<anonymous>)
     at C:\Users\Ron\myApp\.meteor\local\build\programs\server\boot.js:413:9
     at C:\Users\Ron\myApp\.meteor\local\build\programs\server\boot.js:463:5
     at Function.run (C:\Users\Ron\myApp\.meteor\local\build\programs\server\profile.js:510:12)
     at C:\Users\Ron\myApp\.meteor\local\build\programs\server\boot.js:462:11
=> Exited with code: 1

The offending line of code in logging.js is

var _ = Package.underscore._;

but the underscore NPM is installed (I’ve tried both meteor add underscore and meteor npm install --save underscore) so that shouldn’t be the problem. My database was wiped out (because I stupidly forgot that meteor reset also resets the database. Would be nice if the command warned you before doing so), but that shouldn’t prevent my welcome page from displaying.


For anyone reading this that has the same problem, it appears this problem is being tracked as issue #9319.


Sounds like it could be related to the issue I’m having


Doing meteor remove iron:router followed by meteor add iron:router fixed it for me. This obviously won’t help if you don’t use iron:router. Thanks to Michael Underwood for finding this solution.


I wasn’t using iron:router btw. What caused the issue for me was the Meteor Shell. When the Meteor Shell connects, it seems to overwrite _


This fixed it for me as well :slight_smile:


I’m having the same issue but with the random package instead of logging. I tried removing/adding iron:router to no avail…


Solved it by removing underscore and adding it back as an npm package instead.


Thanks for the inspiration there @yelongren. I don’t use underscore anywhere but still had it included. I removed underscore and although it’s still a dependency of other packages (and still in the versions file) this did the trick. Now updated both projects to 1.6! :grinning::sunglasses:


True, this is the solution. My question is: Is the science or the bible able to explain it?