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

Maximum call stack size exceeded when running npm shrinkwrap on 3.10.6 #13327

Closed
1 of 13 tasks
JEBoothjr opened this issue Jul 8, 2016 · 17 comments
Closed
1 of 13 tasks
Assignees
Labels

Comments

@JEBoothjr
Copy link

JEBoothjr commented Jul 8, 2016

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

In npm 3.10.6, I'm attempting to run npm shrinkwrap and getting a "Maximum call stack size exceeded" error. I don't get this on 3.10.5

How can the CLI team reproduce the problem?

I deleted the node_modules folder.
Ran npm cache clean.
Ran npm install
Ran npm shrinkwrap
npm-debug.log: https://gist.github.com/JEBoothjr/8d724fe37047de5f0f9765190f933c73

supporting information:

  • npm -v prints: 3.10.6
  • node -v prints: v0.10.36
  • npm config get registry prints: https://registry.npmjs.org/
  • Windows, OS X, or Linux?: OS X 10.10.5
  • Network issues:
    • Geographic location where npm was run:
    • I use a proxy to connect to the npm registry.
    • I use a proxy to connect to the web.
    • I use a proxy when downloading Git repos.
    • I access the npm registry via a VPN
    • I don't use a proxy, but have limited or unreliable internet access.
  • Container:
    • I develop using Vagrant on Windows.
    • I develop using Vagrant on OS X or Linux.
    • I develop / deploy using Docker.
    • I deploy to a PaaS (Triton, Heroku).
@SimenB
Copy link
Contributor

SimenB commented Jul 11, 2016

Same for me, using node@6.3.0

Stack trace:

35 verbose stack RangeError: Maximum call stack size exceeded
35 verbose stack     at module.exports (/Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/node_modules/aproba/index.js:18:42)
35 verbose stack     at moduleName (/Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/utils/module-name.js:25:3)
35 verbose stack     at exports.isOnlyDev (/Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/install/is-dev.js:39:45)
35 verbose stack     at /Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/install/is-dev.js:33:14
35 verbose stack     at Array.every (native)
35 verbose stack     at exports.isOnlyDev (/Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/install/is-dev.js:39:26)
35 verbose stack     at /Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/install/is-dev.js:33:14
35 verbose stack     at Array.every (native)
35 verbose stack     at exports.isOnlyDev (/Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/install/is-dev.js:39:26)
35 verbose stack     at /Users/simbekkh/.nvm/versions/node/v6.3.0/lib/node_modules/npm/lib/install/is-dev.js:33:14

@hilkeheremans
Copy link

Same here, using node v6.2.0 and npm 3.10.6. As above this does not occur on npm 3.10.5

@Jessidhia
Copy link

Jessidhia commented Jul 11, 2016

Also on less older nodes such as v4.4.7.

@zkat zkat added the big-bug label Jul 11, 2016
@zkat zkat added this to the big-bug-backlog milestone Jul 11, 2016
@iarna iarna self-assigned this Jul 11, 2016
@iarna iarna modified the milestones: 3.10.6, big-bug-backlog, next Jul 11, 2016
@evocateur
Copy link

Definitely caused by #13308. After a bunch of stepping through the fancy new debugging available in node v6.3.0, it's almost definitely line 33 of lib/install/is-dev.js flooding the stack when a dev dependency has a nested "circular" relationship.

Here is a minimal(-ish) repro:

{
  "name": "circular-shrinkwrap",
  "description": "Circular Shrinkwrap",
  "version": "1.0.0",
  "repository": {},
  "license": "MIT",
  "dependencies": {
    "babel-runtime": "^6.9.2"
  },
  "devDependencies": {
    "babel-traverse": "^6.10.4"
  }
}

Notably, the trivial case of babel-runtime in both dependencies and devDependencies does not elicit this bug.

$ npm show --json babel-traverse dependencies
{
  "babel-code-frame": "^6.8.0",
  "babel-messages": "^6.8.0",
  "babel-runtime": "^6.9.0",
  "babel-types": "^6.9.0",
  "babylon": "^6.7.0",
  "debug": "^2.2.0",
  "globals": "^8.3.0",
  "invariant": "^2.2.0",
  "lodash": "^4.2.0"
}

$ npm show --json babel-types dependencies
{
  "babel-runtime": "^6.9.1",
  "babel-traverse": "^6.9.0",
  "esutils": "^2.0.2",
  "lodash": "^4.2.0",
  "to-fast-properties": "^1.0.1"
}

Since babel-types and babel-traverse are circular, npm shrinkwrap errors, yielding this npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '$NVM_ROOT/bin/node',
1 verbose cli   '$NVM_ROOT/bin/npm',
1 verbose cli   'shrinkwrap' ]
2 info using npm@3.10.6
3 info using node@v6.3.0
4 info lifecycle circular-shrinkwrap@1.0.0~preshrinkwrap: circular-shrinkwrap@1.0.0
5 silly lifecycle circular-shrinkwrap@1.0.0~preshrinkwrap: no script for preshrinkwrap, continuing
6 verbose stack RangeError: Maximum call stack size exceeded
6 verbose stack     at $NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:27:19
6 verbose stack     at Array.every (native)
6 verbose stack     at exports.isOnlyDev ($NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:39:26)
6 verbose stack     at $NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:33:14
6 verbose stack     at Array.every (native)
6 verbose stack     at exports.isOnlyDev ($NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:39:26)
6 verbose stack     at $NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:33:14
6 verbose stack     at Array.every (native)
6 verbose stack     at exports.isOnlyDev ($NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:39:26)
6 verbose stack     at $NVM_ROOT/lib/node_modules/npm/lib/install/is-dev.js:33:14
7 verbose cwd /tmp
8 error Darwin 15.5.0
9 error argv "$NVM_ROOT/bin/node" "$NVM_ROOT/bin/npm" "shrinkwrap"
10 error node v6.3.0
11 error npm  v3.10.6
12 error Maximum call stack size exceeded
13 error If you need help, you may report this error at:
13 error     <https://github.com/npm/npm/issues>
14 verbose exit [ 1, true ]

@peterhn
Copy link

peterhn commented Jul 29, 2016

What's the status on this issue? I'm having the same problem whenever I add --save

@vpanjganj
Copy link

@SimenB
Copy link
Contributor

SimenB commented Aug 1, 2016

@peterhn open PR #13399, they're probably on holiday or something 😄

And I think it's infinite loop here, so increasing the stack won't help

@matsomahoney
Copy link

Me too. Yep must be holiday time as v3.10.6 is a month old now
61 verbose stack RangeError: Maximum call stack size exceeded
61 verbose stack at Object.hasOwnProperty (native)
61 verbose stack at isArguments (C:\Users\matt\AppData\Roaming\npm\node_modules\npm\node_modules\aproba\index.js:4:47)
61 verbose stack at Array.types.A (C:\Users\matt\AppData\Roaming\npm\node_modules\npm\node_modules\aproba\index.js:9:68)
61 verbose stack at module.exports (C:\Users\matt\AppData\Roaming\npm\node_modules\npm\node_modules\aproba\index.js:22:18)
61 verbose stack at moduleName (C:\Users\matt\AppData\Roaming\npm\node_modules\npm\lib\utils\module-name.js:25:3)
61 verbose stack at exports.isOnlyDev (C:\Users\matt\AppData\Roaming\npm\node_modules\npm\lib\install\is-dev.js:39:45)
61 verbose stack at C:\Users\matt\AppData\Roaming\npm\node_modules\npm\lib\install\is-dev.js:33:14
61 verbose stack at Array.every (native)
61 verbose stack at exports.isOnlyDev (C:\Users\matt\AppData\Roaming\npm\node_modules\npm\lib\install\is-dev.js:39:26)
61 verbose stack at C:\Users\matt\AppData\Roaming\npm\node_modules\npm\lib\install\is-dev.js:33:14
62 verbose cwd D:\Github
63 error Windows_NT 10.0.10586
64 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\matt\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "shrinkwrap"
65 error node v4.4.7
66 error npm v3.10.6

@mikemaccana
Copy link
Contributor

Thanks for fixing this @iarna! 😃 Should we wait for something newer than 3.10.6 or is there some way to get an npm@latest that's newer than 3.10.6? Thanks.

@SimenB
Copy link
Contributor

SimenB commented Aug 18, 2016

@mikemaccana npm i -g npm@next

szimek added a commit to szimek/bundlerjs that referenced this issue Aug 19, 2016
@sompylasar
Copy link

Looks like this hasn't been released to npm registry as npm@latest, it installs 3.10.6 despite having 3.10.7 released here https://github.com/npm/npm/releases/tag/v3.10.7

@SimenB
Copy link
Contributor

SimenB commented Aug 26, 2016

@sompylasar See my comment above yours, it's still valid.

For future reference, running something like npm show npm dist-tags can help you out. They've also gone to monthly releases, so don't expect a new latest for a couple of weeks

@sompylasar
Copy link

sompylasar commented Aug 26, 2016

@SimenB Sure, thanks, I've installed explicitly by version number after that. Did want to try latest as this was a bugfix release. I would understand a feature or major release to be monthly, but not bugfix releases though...

@ahmetcetin
Copy link

I tried npm install -g npm@next, npm install -g npm@3.10.7, also npm update, still when I check version it says 3.10.6 and npm shrinkwrap still fails (Maximum call stack size exceeded), any thoughts?

@ssteinerx
Copy link
Contributor

Node 6.4.0 and npm 3.10.3 solved this problem for me just now. Installed from OS X .pkg file downloaded directly from Nodejs.org.

@ahmetcetin
Copy link

Well, the problem is, i can use node 6.2.2 max, as it's the supported version by aws elastic beanstalk. Does it mean I'm stuck with the bug?

@SimenB
Copy link
Contributor

SimenB commented Aug 28, 2016

You can do npm i -g npm@3.10.3 if that's the version you want. If you still get the wrong version, there's something wrong with your $PATH.

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

No branches or pull requests