wesleytodd / YeoPress

A Yeoman generator for WordPress
Other
1.08k stars 161 forks source link

error on color.js #21

Closed mrecondo closed 11 years ago

mrecondo commented 11 years ago

/usr/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:53 Object.defineProperty(String.prototype, color, { ^ TypeError: Cannot redefine property: underline at Function.defineProperty (native) at addProperty (/usr/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:53:12) at /usr/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:189:3 at Array.forEach (native) at Object. (/usr/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:184:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)

mrecondo commented 11 years ago

BTW, running on a Fedora 19 64 bits.

ceoaliongroo commented 11 years ago

That same error

Mac OS X yeoman 1.0.0-rc.1.4 npm 1.2.32

Any idea to resolve?

wesleytodd commented 11 years ago

Possibly related to these issues: https://github.com/Marak/colors.js/pull/60

You guys might want to try filing a bug for that repo as I do not think this is a problem with my usage. I can take a look and see if there is anything I can find, but I am guessing it is something to do with the bug above.

ecurtis commented 11 years ago

Running into the same error. I reviewed the color.js issue but I cannot see a fix atm.

fmontes commented 11 years ago

Same thing Mavericks beta

TypeError: Cannot redefine property: underline at Function.defineProperty (native) at addProperty (/usr/local/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:53:12) at /usr/local/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:189:3 at Array.forEach (native) at Object. (/usr/local/lib/node_modules/generator-wordpress/node_modules/colors/colors.js:184:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)

wesleytodd commented 11 years ago

Looks like the commit on that colors repo is just waiting to be merged. I pushed a new version to update the colors version in the package.json just in case.

I am not able to replicate this issue, but if anyone who can can lend some insight and +1's to that ticket, please do so.

rawzone commented 11 years ago

Also getting this error on my side.

yo version 1.0.0-rc.1.4 npm version: 1.3.8

Error:

TypeError: Cannot redefine property: underline
    at Function.defineProperty (native)
    at addProperty (/<path to domain>/public_html/node_modules/generator-wordpress/node_modules/colors/colors.js:53:12)
    at /<path to domain>/public_html/node_modules/generator-wordpress/node_modules/colors/colors.js:189:3
    at Array.forEach (native)
    at Object.<anonymous> (/<path to domain>/public_html/node_modules/generator-wordpress/node_modules/colors/colors.js:184:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
wesleytodd commented 11 years ago

https://github.com/yeoman/yo/commit/94984a2ae92e59efebe0aad7f5b6c42fc1953976

Looks like I am not seeing this because I am still on yo 1.0.0-beta-7. In the above commit, the colors module was replaced with chalk. I would guess that these are incompatible. Since yeoman is using chalk now, we can convert this to it as well. I will explore this and try to push a change asap. Sorry for the inconvenience.

wesleytodd commented 11 years ago

I made the patch from https://github.com/Marak/colors.js/pull/60 and it works. Until they merge and push it to npm this will not work. So if you just apply the change manually where it shows the error posted above it works again. I will be changing over to chalk, but it still doesn't fix the issue because other dependancies rely on colors.

And let this be a lesson on why you do not override or extend core objects in javascript....at least not without being careful....

wesleytodd commented 11 years ago

7d5045e2d27794ad3d2e2ae44985a3895ea8b5f2 Moved to chalk. With the above patch to the colors module it is all working for me. I will leave this open until the patch is no longer necessary.

rawzone commented 11 years ago

No need to apologize @wesleytodd... :)

But I can confirm that doing the patch/fix thingy manualy works. Now a yo wordpress works like it should without any errors.

gaboesquivel commented 11 years ago

yes after patching colors.js in winston/node_modules it works without errors, thanks

jedimorten commented 11 years ago

thanks, worked for backbone requirejs boilerplate as well.

wesleytodd commented 11 years ago

@jedimorten This looks like it will be an issue for all generators. I submitted an issue on Yo to see what we can drum up to get this fixed.

sindresorhus commented 11 years ago

Comment from https://github.com/yeoman/yo/issues/68

This has nothing to do with Chalk, but rather two different versions of colors.js used in different sub dependencies, which makes it break. A good example why you should not extend built-ins. This is also the exact reason I created Chalk; it does not interfere with anything. I would recommend you switch to Chalk and help other generator authors to do the same ;)

wesleytodd commented 11 years ago

@sindresorhus Thanks for the expert input! And I totally agree about not extending builtins, as per above:

And let this be a lesson on why you do not override or extend core objects in javascript....at least not without being careful....

wesleytodd commented 11 years ago

This looks to be fixed. Closing.