我试图运行npm install,这是控制台的输出:

npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8

npm ERR! Maximum call stack size exceeded
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

这是npm-debug.log的内容:

113791 verbose stack RangeError: Maximum call stack size exceeded
113791 verbose stack     at Object.color (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/console-control-strings/index.js:115:32)
113791 verbose stack     at EventEmitter.log._format (/usr/lib/node_modules/npm/node_modules/npmlog/log.js:252:51)
113791 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/log.js:138:24)
113791 verbose stack     at emitThree (events.js:116:13)
113791 verbose stack     at emit (events.js:194:7)
113791 verbose stack     at .<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js:23:18)
113791 verbose stack     at emitThree (events.js:116:13)
113791 verbose stack     at emit (events.js:194:7)
113791 verbose stack     at .<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js:23:18)
113791 verbose stack     at emitThree (events.js:116:13)
113791 verbose stack     at emit (events.js:194:7)
113792 verbose cwd /home/giorgi/AdMove/dev/web-advertiser-admove
113793 error Linux 4.8.0-27-generic
113794 error argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
113795 error node v6.9.1
113796 error npm  v3.10.8
113797 error Maximum call stack size exceeded
113798 error If you need help, you may report this error at:
113798 error     <https://github.com/npm/npm/issues>
113799 verbose exit [ 1, true ]

多次删除node_modules,并尝试重新安装。不能理解是什么原因导致了这个,以及如何解决它。


当前回答

我尝试了这个线程中的所有建议,但没有一个有效,我一直得到RangeError:当我运行'npm install'时,超过了最大调用堆栈大小。我决定直接运行npm start,它成功启动,没有错误…

其他回答

我在Mac上最终成功的一件事是从8.12节点升级到10节点。x使用NVM。

我用NVM卸载了所有其他版本的Node,然后安装了10。x,然后运行nvm alias default node,它告诉nvm总是默认为shell上最新可用的节点版本。

在那之后,我的实时重新加载问题消失了!

错误消息可能与你试图运行的npm进程没有直接关系,它可能是其他正在运行的节点进程冲突或耗尽了资源。

在我的情况下,我有一个空的node_modules文件夹从最近的init和仍然得到

npm犯错!超过最大调用堆栈大小

当运行npm install——save-dev @wordpress/scripts用于WordPress插件开发时。

问题是在我的wp-content文件夹中运行的实时重新加载监视器,并停止了安装第一次工作。

我尝试了一切方法来解决这个问题在我的windows 7机器上

重新安装和重建npm

最后,我浪费了一整天的时间,解决了这个小配置设置问题。

我是如何解决这个问题的

删除全局.npmrc中的项目特定配置 例如drive:/Windows/Users/.. npmrc

如果这些答案都不适合你,这可能是因为你正在使用的终端不是正确的/你的node_modules被你计算机的另一部分使用。

在我的情况下,我一直在这个错误(最大调用堆栈大小超过)和访问错误事件之间杂耍,当我做了一个sudo npm I。

解决办法是关闭我的IDE(也就是WebStorm),在一个基本终端上运行npm i,就是这样。

以下步骤帮助我解决了这个问题:

停止所有的反应条(例如开始构建) 运行NPM cache clean——force 运行NPM install