TooTallNate / ref

Turn Buffer instances into "pointers"
http://tootallnate.github.com/ref
451 stars 141 forks source link

"TypeError: Cannot read property 'name' of undefined" in Node.js 6.9.1 #86

Closed also closed 6 years ago

also commented 6 years ago

With the recent 1.3.5 release of ref, importing the module throws an error in Node.js 6.9.1. I've seen this on macOS 10.12.6 and 10.11.6

$ npm ls ref
/private/tmp/ref-test
└── ref@1.3.5

$ ~/Downloads/node-v6.9.1-darwin-x64/bin/node
> const r = require('ref')
TypeError: Cannot read property 'name' of undefined
    at overwriteInspect (/private/tmp/ref-test/node_modules/ref/lib/ref.js:1455:14)
    at Object.<anonymous> (/private/tmp/ref-test/node_modules/ref/lib/ref.js:1417:32)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at repl:1:11
>

$ node --version
v6.10.2

$ node
> const r = require('ref')
undefined
also commented 6 years ago

Probably related to https://github.com/nodejs/node/pull/9289

chrisJohn404 commented 6 years ago

I am seeing this issue on a windows 10 computer that is running node version v6.6.0. Ref v1.3.4 still works on this version of node.

Tested on Linux (Ubuntu 14, 32 bit and 64bit) running node v5.6.0. Was not running into this error.

TooTallNate commented 6 years ago

https://github.com/TooTallNate/ref/commit/a1b8216fe7 must have broke older versions. Patch welcome if anyone beats me to it!

TooTallNate commented 6 years ago

Ok, so I can repro with v6.9.1, but it doesn't happen on v6.10.3. Can you guys upgrade your Node.js version?

btsimonh commented 6 years ago

I've confirmed this works with 6.9.2; however for various reasons don't want to update (right now); have submitted a simple pull request which disables the enhanced inspection if it would not work..... https://github.com/btsimonh/ref/pull/1

TooTallNate commented 6 years ago

Fixed in #89.