I am developing a fork of a popular wordpress plugin (Sensei-lms) ... the plugin developers have given instructions for creating a development environment on this page: https://github.com/Automattic/sensei/wiki/Setting-Up-Your-Development-Environment#configure-a-local-wordpress-instance
I have created a clean instance as described in the instructions and cloned the git repo
However on running the npm install
command I always get the following errors:
vagrant@vvv:/srv/www/wordpress-one/public_html/wp-content/plugins/sensei$ npm install
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2021-09-07T03_45_45_825Z-debug.log
The log files don't really give any indication of problem other than repeating the problem ...
19886 verbose stack RangeError: Maximum call stack size exceeded
19886 verbose stack at RegExp.test (<anonymous>)
19886 verbose stack at isDepOptional (/usr/lib/node_modules/npm/lib/install/deps.js:432:45)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:441:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19886 verbose stack at failedDependency (/usr/lib/node_modules/npm/lib/install/deps.js:457:9)
19887 verbose cwd /srv/www/sensei/public_html/wp-content/plugins/sensei-lms
19888 verbose Linux 5.4.0-80-generic
19889 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
19890 verbose node v14.17.6
19891 verbose npm v6.14.15
19892 error Maximum call stack size exceeded
19893 verbose exit [ 1, true ]
From my reading it seems that the iteration of dependancies being installed has reached it's limit.
I have tried all the of the following without luck:
1: as per multiple blogs and articles advising to do so
vagrant@vvv:...$ cd /srv/www/wordpress-one/public_html/wp-content/plugins/sensei vagrant@vvv:...$ rm -fr /usr/lib/node_modules vagrant@vvv:...$ rm -fr node_modules/ vagrant@vvv:...$ npm cache clean --force vagrant@vvv:...$ npm rebuild vagrant@vvv:...$ rm package-lock.json vagrant@vvv:...$ npm install
2: as per http://pyha.ru/forum/topic/9396.1
vagrant@vvv:...$ cd /srv/www/wordpress-one/public_html/wp-content/plugins/sensei vagrant@vvv:...$ rm -fr /usr/lib/node_modules vagrant@vvv:...$ rm -fr node_modules/ vagrant@vvv:...$ npm cache clean --force vagrant@vvv:...$ node --stack-size=10000 /usr/lib/node_modules/npm/bin/npm-cli.js install
Any further help - what might I be doing wrong?
Further to this above issue:
I'm running VVV on Macbook Pro and the default setup creates a VVV machine running a bento box of Ubuntu 20.04.3 LTS with a npm 6.14.15 version (from nodejs package version: 14.17.6-deb-1nodesource1)
I've destroyed the VVV instance and started again to work from clean without any issues I might have created in earlier tries - still fails !
I've gone to my desktop linux machine (different machine from the mac running VVV) - the linux desktop is running Ubuntu 20.04.3 LTS natively with default apt install of npm 6.14.4 version (from nodejs package version: 10.19.0~dfsg-3ubuntu1) and with a clean sensei git clone
and npm install
works fine !
It would seem the issue lies with Vagrant (or even VirtualBox) and not npm or sensei....
In a quick google search I discovered the following article: https://www.cloudbees.com/blog/otto-next-generation-vagrant which mentions (emphasis mine):
Vagrant is far from dead, but it suffers from a couple of long-lasting issues, including the resource footprint of virtual machines created, the speed of sharing files between the host and virtual machine, and the speed of making configuration changes to virtual machines.
This made me think if I could run npm on the virtualbox in a folder not shared through to the host machine.... as follows:
vagrant@vvv:~$ pwd /home/vagrant vagrant@vvv:~$ git clone https://github.com/Automattic/sensei.git vagrant@vvv:~$ cd sensei/ vagrant@vvv:~$ npm install
And it worked!
So the next step was to copy the successful node_modules folder from the non-shared folder to the public_html folder and build the assets :
vagrant@vvv:...$ cd /srv/www/wordpress-one/public_html/wp-content/plugins/ vagrant@vvv:...$ git clone https://github.com/Automattic/sensei.git vagrant@vvv:...$ cd sensei/ vagrant@vvv:...$ mv ~/sensei/node_modules/ . vagrant@vvv:...$ npm run build:assets
The mv
took a long time but it worked !
Not sure what will happen down the track if I need to run npm install again but we'll cross that bridge when we come to it.
At least we are working....