Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 446 forks source link

Problem with string prototype usage in Node 6.3.0 #166

Closed vincentwoo closed 6 years ago

vincentwoo commented 8 years ago

In the latest Node 6 release (6.3.0) using colors via the string prototype has mysteriously stopped working:

vwoo@ubuntu:~/execute$ docker run --rm -it node:6.3 bash
> root@fa9577cef6fe:/home# node --version
v6.3.0
root@fa9577cef6fe:/home# node
> var colors = require('colors');
undefined
> "test".red
undefined
> colors.red("test");
'\u001b[31mtest\u001b[39m'

It appears to be working fine in 6.2.2, though:

vwoo@ubuntu:~/execute$ docker run --rm -it node:6.2 bash
root@c7c08dbf4129:/home# node --version
v6.2.2
root@c7c08dbf4129:/home# node
> var colors = require('colors')
undefined
> "test".red
'\u001b[31mtest\u001b[39m'

Very mysterious. Does anyone know what's wrong?

Andrews54757 commented 7 years ago

@vincentwoo It is because __definegetter__ has been deprecated, now, you are supposed to use the get keyword

DABH commented 6 years ago

I'm gong to close this; works fine for me on node 8.9.4 with colors@next. Please re-open if you can reproduce with latest node and colors@next. Thanks!!