【问题标题】:Can't deploy node project: Maximum call stack size exceeded无法部署节点项目:超出最大调用堆栈大小
【发布时间】:2019-09-02 15:14:42
【问题描述】:

我整天都在尝试部署到 MS Azure,但遇到了一个非常令人沮丧的问题。这是我尝试推送时得到的:

remote: npm ERR! Maximum call stack size exceeded
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     D:\local\AppData\npm-cache\_logs\2019-09-02T13_35_12_766Z-debug.log
remote: Failed exitCode=1, command="D:\Program Files (x86)\nodejs\10.14.1\node.exe" "D:\Program Files (x86)\npm\6.4.1\node_modules\npm\bin\npm-cli.js" install --production
remote: An error has occurred during web site deployment.
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.

Azure 中的日志信息量更大。他们指向deps.js,据我所知,它是一个本地节点模块:

...
verbose stack     at RegExp.test (<anonymous>)
verbose stack     at isDepOptional (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:405:45)
verbose stack     at failedDependency (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:414:9)
verbose stack     at failedDependency (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:430:9)
verbose stack     at failedDependency (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:430:9)
verbose stack     at failedDependency (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:430:9)
verbose stack     at failedDependency (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:430:9)
verbose stack     at failedDependency (D:\Program Files (x86)\npm\6.4.1\node_modules\npm\lib\install\deps.js:430:9)
...

我的猜测是我的虚拟机节点坏了。在这种情况下,我该如何解决?我试过npm update -g,但我没有sudo 权限。我也尝试更改版本号标志,但问题仍然存在。

感谢任何建议和意见。

【问题讨论】:

    标签: node.js azure npm


    【解决方案1】:

    听起来您尝试在 Azure WebApp 上部署 NodeJS 应用,但收到错误 remote: npm ERR! Maximum call stack size exceeded

    根据我的经验,您可以尝试两种修复方法。

    1. 尝试通过命令npm cache clean或带有选项-f的相同命令清理路径D:\local\AppData\npm-cache中的npm缓存,然后再次执行您的操作。

    2. 通过升级或降级Node版本的环境变量WEBSITE_NODE_DEFAULT_VERSION的值来升级或降级npm版本,请参考我对另一个SO线程Azure NodeJS version的回答和下图的新图。 Azure WebApp 上可用的节点版本,您可以通过命令ls "D:\Program Files (x86)\nodejs" 列出。 npm 版本会随着 node 版本的变化而变化。然后再次执行您的操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-17
      • 1970-01-01
      • 2015-10-24
      • 2015-12-29
      • 2017-12-27
      • 2020-12-06
      • 2020-11-15
      相关资源
      最近更新 更多