我试图运行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,并尝试重新安装。不能理解是什么原因导致了这个,以及如何解决它。


当前回答

在我的情况下,更新到最新版本:

安装NPM

其他回答

今天我们在运行npm cache clean -force之后运行npm prune时遇到了这个错误。

版本:

node 13.8.0 
npm 6.13.6

删除包锁。Json也适用于这种情况。谢谢大家!

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

重新安装和重建npm

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

我是如何解决这个问题的

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

我不知道为什么,但我用sudo运行npm install,它工作了。

sudo npm install

我不是Windows用户,所以如果你是,试着检查Rene Knop的评论。

对于Unix/OSX用户,我删除了根.npmrc文件~/.npmrc。 在你尝试之前,拜托, 看看那边是否没有必要的东西 您可以使用这个命令将所有内容带入您的终端:cat ~/。npmrc。

如果你有这样的东西:

cat: /Users/$USER/.npmrc: No such file or directory

保存副本:

cp ~/.npmrc ~/.npmrc_copy

现在,尝试删除它(适用于bash用户:Unix / Ubuntu / OSX…):

rm -f ~/.npmrc

这对我很管用。 希望这对其他人有所帮助。

npm cache clean --force

这适用于我的节点8和npm 6+