Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm3 flattening incorrectly in a project install with babel / jest / ? #300

Closed
sterpe opened this issue Oct 20, 2015 · 7 comments

Comments

@sterpe
Copy link

commented Oct 20, 2015

Trying to do a local install of standard=> 5.2 with npm@2 seems fine. But when node_modules/.bin/standard is run it cannot find it's dependencies.

@sterpe

This comment has been minimized.

Copy link
Author

commented Oct 20, 2015

> $ npm i --S standard
standard@5.3.1 node_modules/standard
├── eslint-config-standard-react@1.1.0
├── eslint-config-standard@4.4.0
├── eslint-plugin-standard@1.3.1
├── eslint-plugin-react@3.4.2
├── standard-engine@2.2.0 (get-stdin@4.0.1, find-root@0.1.1, xtend@4.0.0, minimist@1.2.0, multiline@1.0.2, dezalgo@1.0.3, pkg-config@1.1.0, defaults@1.0.3, deglob@1.0.1)
└── standard-format@1.6.8 (esformatter-spaced-lined-comment@2.0.1, stdin@0.0.1, esformatter-quotes@1.0.3, minimist@1.2.0, esformatter-eol-last@1.0.0, esformatter-semicolon-first@1.1.0, deglob@1.0.1, esformatter-literal-notation@1.0.1, esformatter-jsx@2.3.6, esformatter@0.7.3)
13:14:27 [10028\0 the-grid] <sterpe@sf-sterpe-pro15:~/git/rp-core/sterpe/buyerui> $ node_modules/.bin/standard
standard: Unexpected linter output:

Error: Cannot find module 'eslint-config-standard-react'
Referenced from: /Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/standard/rc/.eslintrc
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at readConfigFromFile (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/config.js:155:44)
    at loadConfig (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/config.js:176:22)
    at /Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/config.js:207:46
    at Array.reduceRight (native)
    at loadConfig (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/config.js:191:36)
    at new Config (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/config.js:385:38)

If you think this is a bug in `standard`, open an issue: https://github.com/feross/standard/issues
13:14:49 [10029\1 the-grid] <sterpe@sf-sterpe-pro15:~/git/rp-core/sterpe/buyerui> $ npm i --S standard@5.0
standard@5.0.2 node_modules/standard
├── eslint-config-standard-react@1.0.4
├── eslint-config-standard@4.0.0
├── eslint-plugin-react@3.2.0
├── eslint-plugin-standard@1.2.0 (requireindex@1.1.0)
├── standard-format@1.6.8 (esformatter-spaced-lined-comment@2.0.1, stdin@0.0.1, esformatter-quotes@1.0.3, minimist@1.2.0, esformatter-eol-last@1.0.0, deglob@1.0.1, esformatter-semicolon-first@1.1.0, esformatter-literal-notation@1.0.1, esformatter-jsx@2.3.6, esformatter@0.7.3)
├── eslint@1.0.0 (escape-string-regexp@1.0.3, path-is-absolute@1.0.0, object-assign@2.1.1, path-is-inside@1.0.1, xml-escape@1.0.0, user-home@1.1.1, strip-json-comments@1.0.4, estraverse-fb@1.3.1, globals@8.11.0, estraverse@4.1.1, text-table@0.2.0, debug@2.2.0, optionator@0.5.0, chalk@1.1.1, mkdirp@0.5.1, lodash.merge@3.3.2, minimatch@2.0.10, lodash.omit@3.1.0, lodash.clonedeep@3.0.2, espree@2.2.5, concat-stream@1.5.1, doctrine@0.6.4, is-my-json-valid@2.12.2, js-yaml@3.4.3, escope@3.2.0, inquirer@0.8.5)
└── standard-engine@2.2.0 (get-stdin@4.0.1, find-root@0.1.1, xtend@4.0.0, minimist@1.2.0, multiline@1.0.2, pkg-config@1.1.0, defaults@1.0.3, dezalgo@1.0.3, deglob@1.0.1, eslint@1.7.2)
13:15:54 [10030\0 the-grid] <sterpe@sf-sterpe-pro15:~/git/rp-core/sterpe/buyerui> $ node_modules/.bin/standar
-bash: node_modules/.bin/standar: No such file or directory
13:15:58 [10031\127 the-grid] <sterpe@sf-sterpe-pro15:~/git/rp-core/sterpe/buyerui> $ node_modules/.bin/standard
standard: Use Use JavaScript Standard Style (https://github.com/feross/standard) 
  /Users/sterpe/git/rp-core/sterpe/buyerui/__mocks__/cookies-js.js:1:19: "jest" is not defined.
  /Users/sterpe/git/rp-core/sterpe/buyerui/__mocks__/query-string.js:2:23: "jest" is not defined.
  /Users/sterpe/git/rp-core/sterpe/buyerui/__mocks__/superagent.js:1:22: "jest" is not defined.
  /Users/sterpe/git/rp-core/sterpe/buyerui/__mocks__/superagent.js:10:22: "jest" is not defined.
@sterpe

This comment has been minimized.

Copy link
Author

commented Oct 20, 2015

Updating npm >> 3 fixes the problem.

@feross

This comment has been minimized.

Copy link
Member

commented Oct 20, 2015

ah, interesting. okay, so can this be closed now?

@sterpe

This comment has been minimized.

Copy link
Author

commented Oct 20, 2015

Hmm...It's weird because the symver would not suggest that such a breaking change exists between 5.1 and 5.2,3.

Nor should the behaviour vary between a global and local install (global seems to be okay).

@sterpe

This comment has been minimized.

Copy link
Author

commented Oct 21, 2015

So I am a dumby. The problem I was having using npm@2 was because I still had

1     "devDependencies": {

36      "eslint": "^1.6.0",
37      "eslint-plugin-react": "^3.5.1",

in my package.json...should that break it tho?

removing those caused the install to work fine locally.

However I am noticing an issue when installing npm3 when I install all my deps at same time:

here is my package json https://gist.github.com/sterpe/e37a0e87b743bf85259f

And here is the output of npm i when npm@3 https://gist.github.com/sterpe/ead6d173e9a512a2691b

There must be some conflict in the way npm3 flattens these out because

$ node_modules/.bin/standard
standard: Unexpected linter output:

Error: Unknown node type JSXElement.
    at Controller.traverse (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/node_modules/estraverse/estraverse.js:515:31)
    at Object.traverse (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/node_modules/estraverse/estraverse.js:707:27)
    at SourceCode.getNodeByRangeIndex (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/util/source-code.js:240:20)
    at EventEmitter.api.(anonymous function) [as getNodeByRangeIndex] (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/eslint.js:893:73)
    at RuleContext.(anonymous function) [as getNodeByRangeIndex] (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/rule-context.js:108:33)
    at EventEmitter.Program (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/rules/no-multi-spaces.js:102:46)
    at EventEmitter.emit (events.js:117:20)
    at NodeEventGenerator.enterNode (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/util/node-event-generator.js:42:22)
    at CommentEventGenerator.enterNode (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/util/comment-event-generator.js:98:23)
    at Controller.controller.traverse.enter (/Users/sterpe/git/rp-core/sterpe/buyerui/node_modules/eslint/lib/eslint.js:782:36)

If you think this is a bug in `standard`, open an issue: https://github.com/feross/standard/issues

maybe a conflict with babel or jest?

@sterpe sterpe changed the title local project install only works on 5.2+ w/ npm3 npm3 flattening incorrectly in a project install with babel / jest / ? Oct 21, 2015

@sterpe

This comment has been minimized.

Copy link
Author

commented Oct 21, 2015

I will investigate a bit more and see if I can narrow down the conflict.

Could also potentially be one of the browserify-transforms, they have esprima deps too.

@sterpe

This comment has been minimized.

Copy link
Author

commented Jan 15, 2016

This seems to have been fixed by npm

@sterpe sterpe closed this Jan 15, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.