【问题标题】:npm ERR! Maximum call stack size exceeded when npm install (angular)npm 错误! npm install 时超出最大调用堆栈大小(角度)
【发布时间】:2019-07-17 01:32:26
【问题描述】:

我在运行 npm install 时得到了这个

npm WARN deprecated ts-simple-ast@12.4.0: NOTICE: ts-simple-ast has been renamed to ts-morph and version reset to 1.0.0. Switch at your leisure...
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated mailcomposer@4.0.1: This project is unmaintained
npm WARN deprecated socks@1.1.9: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an
import issue introduced in 2.1.0
npm WARN deprecated uws@9.14.0: New code is available at github.com/uNetworking/uWebSockets.js
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated buildmail@4.0.1: This project is unmaintained
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\1-PC\AppData\Roaming\npm-cache\_logs\2019-02-22T21_56_49_385Z-debug.log

【问题讨论】:

  • 您正在运行什么 npm install 命令以及您在哪里(哪个文件夹)运行它?你有什么版本的 npm?
  • @Salma Ahmed,请添加更多详细信息。您可以在此处找到有关如何在 Stack Overflow 上提出好问题的指南stackoverflow.com/help/how-to-ask
  • 请分享 package.json 文件和一些细节

标签: angular npm


【解决方案1】:

转到您的项目目录并删除 node_modules 文件夹,

rm -rf 节点模块

然后清理你的缓存,

npm 缓存清理 --f

最后重新安装依赖,

npm 我

【讨论】:

  • 这是最好的答案。 10 次中有 9 次是 node_modules 文件夹导致问题(甚至缓存清除都没有帮助)。
  • 是的,删除文件夹 node_modules 工作,在我的情况下,文件夹位置是 C:\Users\user1\AppData\Roaming\npm\node_modules
【解决方案2】:

我使用 Docker 构建了一个 react 项目,得到了类似的错误(虽然这个错误在本地没有重复)。由于递归调用的嵌套限制,返回此错误。

作为一种解决方法,以下命令帮助了我,它增加了递归调用的最大数量:

node --stack-size=2000 /local/lib/node_modules/npm/bin/npm-cli.js 安装

我在Russian-language forum找到了这个解决方案

【讨论】:

  • 这是一个位排序器,没有写出整个目录node --stack-size=2000 $(which npm) install
【解决方案3】:

我在运行create-react-app 命令时遇到了这个问题。尽管命令不同,但 create react app 脚手架在触发安装各种依赖项时也会运行 npm i 命令。

  • 删除位于C:/<name of the root folder>/nvm/v12.18.3/node_modules/npm 中的全局.npmrc 文件
  • 运行 npm cache clean --force 在项目文件夹之外
  • 然后再次运行项目文件夹中的npm i 应该可以解决问题。

代码编辑器:以管理员模式运行的 Visual Studio Code。

主机操作系统:Microsoft Windows 10。

在 Windows 10 中使用 NVM 运行 Node.js。

【讨论】:

    猜你喜欢
    • 2019-07-19
    • 1970-01-01
    • 2016-02-03
    • 1970-01-01
    • 2017-03-26
    • 2019-06-29
    • 2021-03-01
    相关资源
    最近更新 更多