TypeError: Cannot read property '_' of undefined


#1

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:

C:\Users\Ron\myApp\.meteor\local\build\programs\server\boot.js:467
 }).run();
    ^

 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.


#2

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


#3

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


#4

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.


#5

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 _


#6

This fixed it for me as well :slight_smile:


#7

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


#8

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


#9

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:


#10

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