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

[BUG] Fix ERESOLVE error output #2896

Closed
btmills opened this issue Mar 18, 2021 · 3 comments
Closed

[BUG] Fix ERESOLVE error output #2896

btmills opened this issue Mar 18, 2021 · 3 comments
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@btmills
Copy link

btmills commented Mar 18, 2021

Current Behavior:

When I run npm install in https://github.com/eslint/eslint as of tag v7.22.0, npm throws ERESOLVE with the message "Cannot destructure property 'name' of 'node' as it is null."

Expected Behavior:

Now that #2199 is fixed, I'm hopeful we can successfully npm install in eslint/eslint with npm v7 without --legacy-peer-deps. If we're doing something that's incompatible with the new peerdeps model, a more actionable error message would help.

Steps To Reproduce:

$ node --version
v15.11.0
$ npm --version
7.6.3
$ git clone https://github.com/eslint/eslint.git
$ cd eslint
# Latest version as of writing in case a future commit no longer repros
$ git checkout v7.22.0
$ npm install
npm ERR! code ERESOLVE
npm ERR! Cannot destructure property 'name' of 'node' as it is null.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2021-03-18T04_10_40_533Z-debug.log

This stack trace matches #2548 (comment).

~/.npm/_logs/2021-03-18T04_10_40_533Z-debug.log
0 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
1 info using npm@7.6.3
2 info using node@v15.11.0
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:~/eslint/.npmrc Completed in 2ms
9 timing config:load:project Completed in 3ms
10 timing config:load:file:~/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 verbose npm-session a35acf988004864f
20 timing npm:load Completed in 24ms
21 http fetch GET 200 https://registry.npmjs.org/npm 26ms (from cache)
22 timing arborist:ctor Completed in 1ms
23 timing arborist:ctor Completed in 0ms
24 timing idealTree:init Completed in 17ms
25 timing idealTree:userRequests Completed in 0ms
26 silly idealTree buildDeps
27 silly fetch manifest @babel/core@^7.4.3
28 http fetch GET 200 https://registry.npmjs.org/@babel%2fcore 225ms
29 silly fetch manifest @babel/preset-env@^7.4.3
30 http fetch GET 200 https://registry.npmjs.org/@babel%2fpreset-env 114ms
31 silly fetch manifest acorn@^7.2.0
32 http fetch GET 200 https://registry.npmjs.org/acorn 53ms
33 silly fetch manifest babel-loader@^8.0.5
34 http fetch GET 200 https://registry.npmjs.org/babel-loader 47ms
35 silly fetch manifest webpack@^5.23.0
36 http fetch GET 200 https://registry.npmjs.org/webpack 238ms
37 silly fetch manifest chai@^4.0.1
38 http fetch GET 200 https://registry.npmjs.org/chai 86ms
39 silly fetch manifest cheerio@^0.22.0
40 http fetch GET 200 https://registry.npmjs.org/cheerio 58ms
41 silly fetch manifest common-tags@^1.8.0
42 http fetch GET 200 https://registry.npmjs.org/common-tags 63ms
43 silly fetch manifest core-js@^3.1.3
44 http fetch GET 200 https://registry.npmjs.org/core-js 61ms
45 silly fetch manifest dateformat@^3.0.3
46 http fetch GET 200 https://registry.npmjs.org/dateformat 60ms
47 silly fetch manifest ejs@^3.0.2
48 http fetch GET 200 https://registry.npmjs.org/ejs 71ms
49 silly fetch manifest escape-string-regexp@^3.0.0
50 http fetch GET 200 https://registry.npmjs.org/escape-string-regexp 68ms
51 silly fetch manifest eslint-plugin-eslint-plugin@^2.2.1
52 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-eslint-plugin 51ms
53 silly fetch manifest eslint-plugin-jsdoc@^22.1.0
54 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-jsdoc 56ms
55 silly fetch manifest eslint@^6.0.0
56 http fetch GET 200 https://registry.npmjs.org/eslint 81ms
57 timing idealTree Completed in 1449ms
58 timing command:install Completed in 1462ms
59 verbose stack Error: unable to resolve dependency tree
59 verbose stack     at Arborist.[failPeerConflict] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1157:25)
59 verbose stack     at Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1134:34)
59 verbose stack     at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:838:11)
59 verbose stack     at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:209:7)
59 verbose stack     at async Promise.all (index 1)
59 verbose stack     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5)
59 verbose stack     at async Install.install (/usr/local/lib/node_modules/npm/lib/install.js:120:5)
60 verbose cwd ~/eslint
61 verbose Linux 4.19.121-linuxkit
62 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
63 verbose node v15.11.0
64 verbose npm  v7.6.3
65 error code ERESOLVE
66 verbose stack TypeError: Cannot destructure property 'name' of 'node' as it is null.
66 verbose stack     at printNode (/usr/local/lib/node_modules/npm/lib/utils/explain-dep.js:29:5)
66 verbose stack     at explainNode (/usr/local/lib/node_modules/npm/lib/utils/explain-dep.js:13:3)
66 verbose stack     at explainEresolve (/usr/local/lib/node_modules/npm/lib/utils/explain-eresolve.js:24:24)
66 verbose stack     at report (/usr/local/lib/node_modules/npm/lib/utils/explain-eresolve.js:50:3)
66 verbose stack     at module.exports (/usr/local/lib/node_modules/npm/lib/utils/error-message.js:22:24)
66 verbose stack     at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:175:15)
66 verbose stack     at /usr/local/lib/node_modules/npm/lib/npm.js:114:9
67 verbose cwd ~/eslint
68 verbose Linux 4.19.121-linuxkit
69 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
70 verbose node v15.11.0
71 verbose npm  v7.6.3
72 error Cannot destructure property 'name' of 'node' as it is null.
73 verbose exit 1

Environment:

  • OS: macOS 11.2.3 (Intel) or Docker node:15
  • Node: 15.11.0
  • npm: 7.6.3
@btmills btmills added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Mar 18, 2021
@nlf
Copy link
Contributor

nlf commented Mar 22, 2021

definitely a bug in how we report the ERESOLVE error here

if it helps, the problem is that eslint-plugin-jsdoc@22.2.0 has a peer dependency on eslint@^6.0.0, but eslint@file:. is listed as a dev dependency, which yields eslint 7.22.0 (as in the checked out commit) being linked as a dependency, which conflicts.

the fix would be to update eslint-plugin-jsdoc to have a version with a peer dependency on eslint@^7.0.0 (or some other range compatible with the current release)

@btmills
Copy link
Author

btmills commented Mar 23, 2021

That's incredibly helpful. Thank you! I just upgraded eslint-plugin-jsdoc to a version that includes eslint@^7.0.0 in the peer dependency range. That turned out to be the last incompatibility, so we're now able to npm install in eslint/eslint without --legacy-peer-deps! I'll leave this open for the error reporting bug, but we're unblocked now.

@wraithgar wraithgar changed the title [BUG] Cannot destructure property 'name' of 'node' as it is null. [BUG] Fix ERESOLVE error output Mar 26, 2021
@wraithgar wraithgar added Priority 2 secondary priority issue Priority 1 high priority issue and removed Needs Triage needs review for next steps Priority 2 secondary priority issue labels Mar 26, 2021
isaacs added a commit that referenced this issue Apr 1, 2021
* [#2896](#2896) Provide currentEdge in
  ERESOLVE if known, and address self-linking edge case.
* Add/remove dependencies to/from workspaces when set, not root project
* Only reify the portions of the dependency graph identified by the
  `workspace` configuration value.
* Do not recursively `chown` the project root path.
@nlf
Copy link
Contributor

nlf commented Apr 12, 2021

this error message was improved in npm@7.8.0

@nlf nlf closed this as completed Apr 12, 2021
feelepxyz added a commit to dependabot/dependabot-core that referenced this issue Apr 16, 2021
Changes since 7.7.4: https://github.com/npm/cli/blob/latest/CHANGELOG.md

## v7.10.0 (2021-04-15)

### FEATURES

* [`f9b639eb6`](npm/cli@f9b639e)
  [#3052](npm/cli#3052)
  feat(bugs): fall back to email if provided
  ([@Yash-Singh1](https://github.com/Yash-Singh1))
* [`8c9e24778`](npm/cli@8c9e247)
  [#3055](npm/cli#3055)
  feat(version): add workspace support
  ([@wraithgar](https://github.com/wraithgar))

### DEPENDENCIES

* [`f1e6743a6`](npm/cli@f1e6743)
  `libnpmversion@1.2.0`
    * feat(retrieve-tag): retrieve unannotated git tags
    * fix(retrieve-tag): use semver to look for semver
* [`3b476a24c`](npm/cli@3b476a2)
  `@npmcl/git@2.0.8`
    * fix(git): do not use shell when calling git
* [`dfcd0c1e2`](npm/cli@dfcd0c1)
  [#3069](npm/cli#3069)
  `tap@15.0.2`

### DOCUMENTATION

* [`90b61eda9`](npm/cli@90b61ed)
  [#3053](npm/cli#3053)
  fix(contributing.md): explicitely outline dep updates
  ([@darcyclarke](https://github.com/darcyclarke))

## v7.9.0 (2021-04-08)

### FEATURES

* [`1f3e88eba`](npm/cli@1f3e88e)
  [#3032](npm/cli#3032)
  feat(dist-tag): add workspace support
  ([@nlf](https://github.com/nlf))
* [`6e31df4e7`](npm/cli@6e31df4)
  [#3033](npm/cli#3033)
  feat(pack): add workspace support
  ([@wraithgar](https://github.com/wraithgar))

### DEPENDENCIES

* [`ba4f7fea8`](npm/cli@ba4f7fe)
  `licensee@8.2.0`

## v7.8.0 (2021-04-01)

### FEATURES


* [`8bcc5d73f`](npm/cli@8bcc5d7)
  [#2972](npm/cli#2972)
  feat(workspaces): add repo and docs
  ([@wraithgar](https://github.com/wraithgar))
* [`ec520ce32`](npm/cli@ec520ce)
  [#2998](npm/cli#2998)
  feat(set-script): implement workspaces
* [`32717a60e`](npm/cli@32717a6)
  [#3001](npm/cli#3001)
  feat(view): add workspace support
  ([@wraithgar](https://github.com/wraithgar))
* [`7b177e43f`](npm/cli@7b177e4)
  [#3014](npm/cli#3014)
  feat(config): add 'envExport' flag
  ([@isaacs](https://github.com/isaacs))

### BUG FIXES

* [`4c4252348`](npm/cli@4c42523)
  [#3016](npm/cli#3016)
  fix(usage): specify the key each time for multiples
  ([@isaacs](https://github.com/isaacs))
* [`9237d375b`](npm/cli@9237d37)
  [#3013](npm/cli#3013)
  fix(docs): add workspaces configuration
  ([@wraithgar](https://github.com/wraithgar))
* [`cb6eb0d20`](npm/cli@cb6eb0d)
  [#3015](npm/cli#3015)
  fix(ERESOLVE): better errors when current is missing
  ([@isaacs](https://github.com/isaacs))

### DEPENDENCIES

* [`61da39beb`](npm/cli@61da39b)
  `@npmcli/config@2.1.0`
  * feat(config): add support for envExport:false
* [`fb095a708`](npm/cli@fb095a7)
  `@npmcli/arborist@2.3.0`:
  * [#2896](npm/cli#2896) Provide currentEdge in
  ERESOLVE if known, and address self-linking edge case.
  * Add/remove dependencies to/from workspaces when set, not root project
  * Only reify the portions of the dependency graph identified by the
  `workspace` configuration value.
  * Do not recursively `chown` the project root path.

## v7.7.6 (2021-03-29)

### BUG FIXES

* [`9dd2ed518`](npm/cli@9dd2ed5)
  fix empty newline printed to stderr
  ([@ruyadorno](https://github.com/ruyadorno))
* [`9d391462a`](npm/cli@9d39146)
  [#2973](npm/cli#2973)
  fix spelling in workspaces.md file
  ([@sethomas](https://github.com/sethomas))
* [`4b100249a`](npm/cli@4b10024)
  [#2979](npm/cli#2979)
  change 'maxsockets' default value back to 15
  ([@wallrat](https://github.com/wallrat))

### DEPENDENCIES

* [`a28f89572`](npm/cli@a28f895)
  `libnpmversion@1.1.0`
    * fix reading `script-shell` config on `npm version` lifecycle scripts
* [`03734c29e`](npm/cli@03734c2)
  `npm-packlist@2.1.5`
    * fix packaging `bundledDependencies`
* [`80ce2a019`](npm/cli@80ce2a0)
  `@npmcli/metavuln-calculator@1.1.1`
    * fix error auditing package documents with missing dependencies

## v7.7.5 (2021-03-25)

### BUG FIXES

* [`95ba87622`](npm/cli@95ba876)
  [#2949](npm/cli#2949)
  fix handling manual indexes in `npm help`
  ([@dmchurch](https://github.com/dmchurch))
* [`59cf37962`](npm/cli@59cf379)
  [#2958](npm/cli#2958)
  always set `npm.command` to canonical command name
  ([@isaacs](https://github.com/isaacs))
* [`1415b4bde`](npm/cli@1415b4b)
  [#2964](npm/cli#2964)
  fix(config): properly translate user-agent
  ([@wraithgar](https://github.com/wraithgar))
* [`59271936d`](npm/cli@5927193)
  [#2965](npm/cli#2965)
  fix(config): tie save-exact/save-prefix together
  ([@wraithgar](https://github.com/wraithgar))

### TESTS

* [`97b415287`](npm/cli@97b4152)
  [#2959](npm/cli#2959)
  add smoke tests
  ([@ruyadorno](https://github.com/ruyadorno))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants