Maximum call stack size exceeded during npm update

cli
priority:medium
triaged

(Jacob Page) #1

What I Wanted to Do

Upgrade a nested dependency

What Happened Instead

A runtime error from npm

Reproduction Steps

Example attempt:

npm update --no-save --depth=9999 ansi-styles

Details

NPM log:

0 info it worked if it ends with ok
1 verbose cli [ '/Users/jpage/.nvm/versions/node/v8.11.2/bin/node',
1 verbose cli   '/Users/jpage/.nvm/versions/node/v8.11.2/bin/npm',
1 verbose cli   'update',
1 verbose cli   '--no-save',
1 verbose cli   '--depth=9999',
1 verbose cli   'ansi-styles' ]
2 info using npm@6.3.0
3 info using node@v8.11.2
4 verbose npm-session 9cc07c9cfa928ab3
5 verbose update computing outdated modules to update
6 silly mapToRegistry name ansi-styles
7 silly mapToRegistry using default registry
8 silly mapToRegistry registry https://artifactory.secureserver.net/artifactory/api/npm/node-virt/
9 silly mapToRegistry data { type: 'tag',
9 silly mapToRegistry   registry: true,
9 silly mapToRegistry   where: undefined,
9 silly mapToRegistry   raw: 'ansi-styles',
9 silly mapToRegistry   name: 'ansi-styles',
9 silly mapToRegistry   escapedName: 'ansi-styles',
9 silly mapToRegistry   scope: undefined,
9 silly mapToRegistry   rawSpec: '',
9 silly mapToRegistry   saveSpec: null,
9 silly mapToRegistry   fetchSpec: 'latest',
9 silly mapToRegistry   gitRange: undefined,
9 silly mapToRegistry   gitCommittish: undefined,
9 silly mapToRegistry   hosted: undefined }
10 silly mapToRegistry uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
11 verbose request uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
12 verbose request always-auth set; sending authorization
13 info attempt registry request try #1 at 17:07:34
14 verbose request id 83030ee785144335
15 http request GET https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
16 silly mapToRegistry name ansi-styles
17 silly mapToRegistry using default registry
18 silly mapToRegistry registry https://artifactory.secureserver.net/artifactory/api/npm/node-virt/
19 silly mapToRegistry data { type: 'tag',
19 silly mapToRegistry   registry: true,
19 silly mapToRegistry   where: undefined,
19 silly mapToRegistry   raw: 'ansi-styles',
19 silly mapToRegistry   name: 'ansi-styles',
19 silly mapToRegistry   escapedName: 'ansi-styles',
19 silly mapToRegistry   scope: undefined,
19 silly mapToRegistry   rawSpec: '',
19 silly mapToRegistry   saveSpec: null,
19 silly mapToRegistry   fetchSpec: 'latest',
19 silly mapToRegistry   gitRange: undefined,
19 silly mapToRegistry   gitCommittish: undefined,
19 silly mapToRegistry   hosted: undefined }
20 silly mapToRegistry uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
21 verbose request uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
22 verbose request always-auth set; sending authorization
23 info attempt registry request try #1 at 17:07:34
24 http request GET https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
25 silly mapToRegistry name ansi-styles
26 silly mapToRegistry using default registry
27 silly mapToRegistry registry https://artifactory.secureserver.net/artifactory/api/npm/node-virt/
28 silly mapToRegistry data { type: 'tag',
28 silly mapToRegistry   registry: true,
28 silly mapToRegistry   where: undefined,
28 silly mapToRegistry   raw: 'ansi-styles',
28 silly mapToRegistry   name: 'ansi-styles',
28 silly mapToRegistry   escapedName: 'ansi-styles',
28 silly mapToRegistry   scope: undefined,
28 silly mapToRegistry   rawSpec: '',
28 silly mapToRegistry   saveSpec: null,
28 silly mapToRegistry   fetchSpec: 'latest',
28 silly mapToRegistry   gitRange: undefined,
28 silly mapToRegistry   gitCommittish: undefined,
28 silly mapToRegistry   hosted: undefined }
29 silly mapToRegistry uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
30 verbose request uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
31 verbose request always-auth set; sending authorization
32 info attempt registry request try #1 at 17:07:34
33 http request GET https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
34 silly mapToRegistry name ansi-styles
35 silly mapToRegistry using default registry
36 silly mapToRegistry registry https://artifactory.secureserver.net/artifactory/api/npm/node-virt/
37 silly mapToRegistry data { type: 'tag',
37 silly mapToRegistry   registry: true,
37 silly mapToRegistry   where: undefined,
37 silly mapToRegistry   raw: 'ansi-styles',
37 silly mapToRegistry   name: 'ansi-styles',
37 silly mapToRegistry   escapedName: 'ansi-styles',
37 silly mapToRegistry   scope: undefined,
37 silly mapToRegistry   rawSpec: '',
37 silly mapToRegistry   saveSpec: null,
37 silly mapToRegistry   fetchSpec: 'latest',
37 silly mapToRegistry   gitRange: undefined,
37 silly mapToRegistry   gitCommittish: undefined,
37 silly mapToRegistry   hosted: undefined }
38 silly mapToRegistry uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
39 verbose request uri https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
40 verbose request always-auth set; sending authorization
41 info attempt registry request try #1 at 17:07:34
42 http request GET https://artifactory.secureserver.net/artifactory/api/npm/node-virt/ansi-styles
43 verbose stack RangeError: Maximum call stack size exceeded
43 verbose stack     at outdated_ (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:1:1)
43 verbose stack     at skip (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:313:5)
43 verbose stack     at shouldUpdate (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:328:55)
43 verbose stack     at /Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:296:23
43 verbose stack     at /Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
43 verbose stack     at Array.forEach (<anonymous>)
43 verbose stack     at /Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
43 verbose stack     at Array.forEach (<anonymous>)
43 verbose stack     at asyncMap (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
43 verbose stack     at outdated_ (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:283:3)
43 verbose stack     at skip (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:313:5)
43 verbose stack     at shouldUpdate (/Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:328:55)
43 verbose stack     at /Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/lib/outdated.js:296:23
43 verbose stack     at /Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
43 verbose stack     at Array.forEach (<anonymous>)
43 verbose stack     at /Users/jpage/.nvm/versions/node/v8.11.2/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
44 verbose cwd /Users/jpage/Code/gd-webapp
45 verbose Darwin 17.7.0
46 verbose argv "/Users/jpage/.nvm/versions/node/v8.11.2/bin/node" "/Users/jpage/.nvm/versions/node/v8.11.2/bin/npm" "update" "--no-save" "--depth=9999" "ansi-styles"
47 verbose node v8.11.2
48 verbose npm  v6.3.0
49 error Maximum call stack size exceeded
50 verbose exit [ 1, true ]

Platform Info

$ npm --versions
{ '@godaddy/gd-webapp': '3.4.0',
  npm: '6.3.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.29.0',
  node: '8.11.2',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }

$ node -p process.platform
darwin

(Jacob Page) #2

FWIW, a smaller depth doesn’t cause a stack overflow, but depth=99 is causing an update to take forever (hopefully will actually complete)