NPM 在 `npm install` 期间失败并出现 'npm ERR! Maximum call stack size exceeded' 错误
NPM fails during `npm install` with 'npm ERR! Maximum call stack size exceeded' error
我正在开发一个流行的 wordpress 插件 (Sensei-lms) 的分支...插件开发人员在此页面上提供了创建开发环境的说明:https://github.com/Automattic/sensei/wiki/Setting-Up-Your-Development-Environment#configure-a-local-wordpress-instance
我已经按照说明创建了一个干净的实例并克隆了 git 存储库
但是在 运行 npm install
命令中我总是得到以下错误:
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
除了重复问题之外,日志文件并没有真正给出任何问题的迹象...
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 ]
根据我的阅读,安装的依赖项的迭代似乎已达到极限。
我尝试了以下所有方法,但都没有成功:
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
任何进一步的帮助 - 我可能做错了什么?
关于上述问题:
我在 Macbook Pro 上使用 运行 VVV,默认设置会创建一个 VVV machine 运行 一个 Ubuntu 20.04 便当盒具有 npm 6.14.15 版本的 .3 LTS(来自 nodejs 包版本:14.17.6-deb-1nodesource1)
我已经销毁了 VVV 实例并再次从干净开始工作,没有任何我在早期尝试中可能产生的问题 - 仍然失败!
我已经进入我的桌面 linux machine(不同于 machine 与 mac 运行 VVV) - linux 桌面是 运行 Ubuntu 20.04.3 LTS 本机,默认 apt 安装 npm 6.14.4 版本(来自 nodejs 包版本:10.19.0~dfsg-3ubuntu1)和一个干净的老师 git clone
和 npm install
工作正常!
问题似乎出在 Vagrant(甚至 VirtualBox)上,而不是 npm 或 sensei....
在快速 google 搜索中,我发现了以下文章:https://www.cloudbees.com/blog/otto-next-generation-vagrant 其中提到(强调我的):
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.
这让我想到我是否可以 运行 在未共享到主机的文件夹中的 virtualbox 上使用 npm...,如下所示:
vagrant@vvv:~$ pwd
/home/vagrant
vagrant@vvv:~$ git clone https://github.com/Automattic/sensei.git
vagrant@vvv:~$ cd sensei/
vagrant@vvv:~$ npm install
成功了!
所以下一步是将成功的 node_modules 文件夹从非共享文件夹复制到 public_html 文件夹并构建资产:
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
mv
花了很长时间,但它奏效了!
不确定如果我需要再次 运行 npm install 会发生什么,但是当我们到达它时我们会穿过那座桥。
至少我们在工作....
我正在开发一个流行的 wordpress 插件 (Sensei-lms) 的分支...插件开发人员在此页面上提供了创建开发环境的说明:https://github.com/Automattic/sensei/wiki/Setting-Up-Your-Development-Environment#configure-a-local-wordpress-instance
我已经按照说明创建了一个干净的实例并克隆了 git 存储库
但是在 运行 npm install
命令中我总是得到以下错误:
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
除了重复问题之外,日志文件并没有真正给出任何问题的迹象...
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 ]
根据我的阅读,安装的依赖项的迭代似乎已达到极限。
我尝试了以下所有方法,但都没有成功:
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
任何进一步的帮助 - 我可能做错了什么?
关于上述问题:
我在 Macbook Pro 上使用 运行 VVV,默认设置会创建一个 VVV machine 运行 一个 Ubuntu 20.04 便当盒具有 npm 6.14.15 版本的 .3 LTS(来自 nodejs 包版本:14.17.6-deb-1nodesource1)
我已经销毁了 VVV 实例并再次从干净开始工作,没有任何我在早期尝试中可能产生的问题 - 仍然失败!
我已经进入我的桌面 linux machine(不同于 machine 与 mac 运行 VVV) - linux 桌面是 运行 Ubuntu 20.04.3 LTS 本机,默认 apt 安装 npm 6.14.4 版本(来自 nodejs 包版本:10.19.0~dfsg-3ubuntu1)和一个干净的老师
git clone
和npm install
工作正常!
问题似乎出在 Vagrant(甚至 VirtualBox)上,而不是 npm 或 sensei....
在快速 google 搜索中,我发现了以下文章:https://www.cloudbees.com/blog/otto-next-generation-vagrant 其中提到(强调我的):
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.
这让我想到我是否可以 运行 在未共享到主机的文件夹中的 virtualbox 上使用 npm...,如下所示:
vagrant@vvv:~$ pwd /home/vagrant vagrant@vvv:~$ git clone https://github.com/Automattic/sensei.git vagrant@vvv:~$ cd sensei/ vagrant@vvv:~$ npm install
成功了!
所以下一步是将成功的 node_modules 文件夹从非共享文件夹复制到 public_html 文件夹并构建资产:
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
mv
花了很长时间,但它奏效了!
不确定如果我需要再次 运行 npm install 会发生什么,但是当我们到达它时我们会穿过那座桥。
至少我们在工作....