Page MenuHomePhabricator

npm::install: Maximum call stack size exceeded
Open, LowPublic

Description

==> default: Notice: /Stage[main]/Restbase/Service::Node[restbase]/Npm::Install[/vagrant/srv/restbase]/Exec[/vagrant/srv/restbase_npm_install]/returns: npm ERR! Maximum call stack size exceeded
==> default: Error: /usr/bin/npm install --no-bin-links returned 1 instead of one of [0]

Apparently this is a known issue with npm --no-bin-links. Re-running npm would fix it, but that won't happen since the node_modules directory exists so npm::install will think there is nothing to do. We probably need a wrapper script.

Workaround is to run NPM_CONFIG_CACHE=/tmp/cache/npm NPM_CONFIG_GLOBAL=false LINK=g++ HOME=/home/vagrant /usr/bin/npm install --no-bin-links in the affected directory repeatedly until it succeeds.

Event Timeline

We probably need a wrapper script.

+1. We need to keep the --no-bin-link argument for systems that don't support symbolic links, but the users have NFS in MW-Vagrant.

This problem was occurring for me when I used vagrant enable-role visualeditor. I tried a lot of things to fix this. In the end, it took a lot of trial and error, but I managed to find a workaround. I've listed the steps I took below for those that are vagrant noobs like me. :-) Maybe someone more knowledgeable can tell me whether some of these steps can be pruned, or whether it was a total coincidence.

First, I increased the amount of RAM allocated to the VM.

  1. From vagrant folder, open lib/mediawiki-vagrant/settings/definitions.rb/
  2. Change default RAM (for me, this was line 14 in the file) to something larger (for me, 2048 -> 4096)

I thought this might work on its own, but it didn't. So, second, I booted the VM and updated npm.

  1. vagrant up
  2. vagrant ssh
  3. npm install -g npm

Third, I cleared out all the stuff that was lying around from the failed install in case that got in the way somehow.

  1. cd /vagrant/srv/restbase
  2. rm -rf node_modules/ ~/.npm/

I retried from the start with npm install --no-bin-links and it worked!

Aklapper triaged this task as Low priority.Dec 6 2022, 10:26 AM
This comment was removed by Aklapper.