Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

[TRACKING] NODE_PATH collisions in builder itself vs other deps #99

Closed
1 of 4 tasks
ryan-roemer opened this issue Mar 1, 2016 · 5 comments · Fixed by #104
Closed
1 of 4 tasks

[TRACKING] NODE_PATH collisions in builder itself vs other deps #99

ryan-roemer opened this issue Mar 1, 2016 · 5 comments · Fixed by #104

Comments

@ryan-roemer
Copy link
Member

From the trenches:

  • Lodash somehow became 4.5.x despite 3.10.x being in this package.json. This is like due to NODE_PATH munging and the fact that builder/node_modules is not currently part of the NODE_PATH resolution.
  • Many methods like .map() lost this as a last argument option.

Task

  • Add builder/node_modules to NODE_PATH and figure out how to deal with potential conflicts with other lodash etc. conflicts... (This may be hard -- test by dropping ROOT/lodash of different versions).
  • Maybe update to lodash 4.5

Error:

[builder:config:environment] {"cwd":"/PATH/TO","dir":"/PATH/TO/node_modules/builder/lib"}
/PATH/TO/node_modules/builder/lib/config.js:143
      return _.extend({ name: name }, this._loadArchetypePkg(name));
                                          ^

TypeError: Cannot read property '_loadArchetypePkg' of undefined
    at /PATH/TO/node_modules/builder/lib/config.js:143:43
    at arrayMap (/PATH/TO/node_modules/lodash/lodash.js:604:23)
    at Function.map (/PATH/TO/node_modules/lodash/lodash.js:7974:14)
    at interceptor (/PATH/TO/node_modules/lodash/lodash.js:14821:35)
    at thru (/PATH/TO/node_modules/lodash/lodash.js:7262:14)
    at /PATH/TO/node_modules/lodash/lodash.js:3736:28
    at arrayReduce (/PATH/TO/node_modules/lodash/lodash.js:647:21)
    at baseWrapperValue (/PATH/TO/node_modules/lodash/lodash.js:3735:14)
    at LazyWrapper.lazyValue [as value] (/PATH/TO/node_modules/lodash/lodash.js:1682:16)
    at baseWrapperValue (/PATH/TO/node_modules/lodash/lodash.js:3733:25)
@ryan-roemer ryan-roemer added the bug label Mar 1, 2016
@ryan-roemer ryan-roemer changed the title BUG: Lodash weirdness (this arg, flattening). BUG: NODE_PATH collisions in builder itself vs other deps Mar 2, 2016
@ryan-roemer
Copy link
Member Author

Ack! Github commit messages gone awry! This is only bandaided with #104, not fixed, so re-opening.

@ryan-roemer ryan-roemer reopened this Mar 11, 2016
@ryan-roemer
Copy link
Member Author

Issues #107 overrides this issue and we should come back to it / solve this at the same time.

@ryan-roemer
Copy link
Member Author

Reviewing the mechanics of what would have to happen, I think this is really the artifact of needing a completely clean node_modules install and the issue manifested like:

Original: both root and builder use lodash@3.x

root/
  node_modules/
    lodash@3.x
    builder

Then a local, not-from-scratch upgrade left us with:

root/
  node_modules/
    lodash@4.x
    builder
      node_modules/
        // NO LODASH HERE

whereas a clean install would have done:

root/
  node_modules/
    lodash@4.x
    builder
      node_modules/
        lodash@3.x

Which would have had builder pick up the correct lodash.

Going to switch this to a [TRACKING] issue instead.

UPDATE: This is looking less likely given experiments at https://github.com/FormidableLabs/install-experiments-npmv3

@ryan-roemer ryan-roemer changed the title BUG: NODE_PATH collisions in builder itself vs other deps [TRACKING] NODE_PATH collisions in builder itself vs other deps Apr 5, 2016
@ryan-roemer ryan-roemer removed the bug label Apr 5, 2016
@ryan-roemer
Copy link
Member Author

ryan-roemer commented Jun 17, 2016

New Chalk issue:

<project>/node_modules/chalk/index.js:76
    var originalDim = ansiStyles.dim.open;
                                    ^

TypeError: Cannot read property 'open' of undefined
    at Function.applyStyle (<project>/node_modules/chalk/index.js:76:34)
    at Chalk.builder (<project>/node_modules/chalk/index.js:40:21)
    at Object.module.exports._wrapper (<project>/node_modules/builder/lib/log.js:97:37)
    at <project>/node_modules/builder/lib/log.js:67:21
    at Array.forEach (native)
    at Object.module.exports._drainQueue (<project>/node_modules/builder/lib/log.js:66:24)
    at Object.module.exports.setLevel (<project>/node_modules/builder/lib/log.js:54:9)
    at module.exports (<project>/node_modules/builder/bin/builder-core.js:35:7)
    at Object.<anonymous> (/Users/rye/scm/fmd/builder/bin/builder.js:43:1)
    at Module._compile (module.js:435:26)

Tree:

$ npm ls | grep chalk
│ │ │ │   │ │ ├─┬ chalk@1.1.3
│ │ ├─┬ chalk@0.4.0
│ │   │ ├─┬ chalk@0.4.0
│ │ └─┬ chalk@1.1.1
│   │ ├─┬ chalk@0.4.0
│ │ │ │ ├─┬ chalk@1.1.1
│ │ │   │ │ ├─┬ chalk@0.4.0
│ ├─┬ chalk@1.1.3
│ │ ├─┬ chalk@1.1.1

The issue is ansi-styles. On a manual install of builder, this works without error:

$ cat node_modules/chalk/package.json | grep ansi-styles
    "ansi-styles": "^2.2.1",
$ cat node_modules/chalk/node_modules/ansi-styles/package.json | grep version
  "version": "2.2.1"
$ cat node_modules/ansi-styles/package.json | grep version
  "version": "1.0.0"

vs. on an install with the error, the same is:

$ cat node_modules/chalk/package.json | grep ansi-styles
    "ansi-styles": "^2.2.1",
$ cat node_modules/chalk/node_modules/ansi-styles/package.json | grep version
cat: node_modules/chalk/node_modules/ansi-styles/package.json: No such file or directory
$ cat node_modules/ansi-styles/package.json | grep version
  "version": "1.0.0"

@ryan-roemer
Copy link
Member Author

This whole thing is likely npm/npm#10727. Closing unless reoccurrence without "double install" scenario appears.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant