Skip to content

Instantly share code, notes, and snippets.

@indexzero
Created December 9, 2011 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indexzero/1451296 to your computer and use it in GitHub Desktop.
Save indexzero/1451296 to your computer and use it in GitHub Desktop.

If two versions of colors exist on disk then this will always throw. This is extremely common in development scenarios with npm link but also if two packages depended on by a third both depend on colors but the parent does not.

  parent-app
  `--- pkg-a
  |   `---colors
  `--- pkg-b
     `---colors
require('colors');
require('winston');
mkdir colors-explodes
cd colors-explodes
#
# 1. Copy the package.json and colors-explodes.js
# in this gist
#
$ npm install
colors@0.6.0 ./node_modules/colors
#
# 2. Make a local copy of winston and link it
#
$ mkdir local
$ cd local
$ git clone https://github.com/flatiron/winston.git
$ cd winston
$ npm link
$ cd ../../
$ npm link winston
$ ./node_modules/winston -> /.local/lib/node_modules/winston -> /colors-explode/local/winston
#
# 3. Run colors-explodes.js and watch it explode
#
$ node colors-explodes.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: underline already exists on String.prototype, cannot override.
at /colors-explode/local/winston/node_modules/colors/colors.js:50:11
at /colors-explode/local/winston/node_modules/colors/colors.js:68:3
at Array.forEach (native)
at Object.<anonymous> (/colors-explode/local/winston/node_modules/colors/colors.js:63:3)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object.<anonymous> (/colors-explode/local/winston/lib/winston/config.js:9:14)
{
"name" : "colors-explodes",
"version" : "0.0.0",
"description" : "color@0.6.0 + `npm link` === explode",
"bin": {
"explode": "./colors-explodes.js"
},
"dependencies" : {
"colors" : "*"
},
"license" : "MIT",
"engine" : {
"node" : ">=0.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment