public
Created

  • Download Gist
README.md
Markdown

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
colors-explodes.js
JavaScript
1 2
require('colors');
require('winston');
install-explode.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
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)
package.json
JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
{
"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"
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.