无法在Heroku上安装Node.js依赖项

尝试将Node.js应用程序部署到heroku时出现内存错误。似乎没有超越安装部分:

remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.13.1...
remote:        Using default npm version: 6.12.1
remote:
remote: -----> Restoring cache
remote:        Cached directories were not restored due to a change in version of node,npm,yarn or stack
remote:        Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote:        Installing node modules (package.json + package-lock)
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!     /tmp/npmcache.TGwfg/_logs/2019-11-23T11_15_42_537Z-debug.log

我尝试关闭模块缓存,但没有执行任何操作。我还尝试过打开更详细的npm日志记录,但是所有告诉我的是安装尚未完成。

应用程序不是特别大,只是一个快速应用程序。必须有一些依赖项,其中包含大量的安装前/安装后命令...我想唯一的方法是一次卸载一个并重新部署:(

但是在我沿着那条路线走之前,我想我想问一下周围是否有人曾经历过这种情况。我目前仅使用免费的测功机来测试Heroku是否适合。

zzlxf85 回答:无法在Heroku上安装Node.js依赖项

事实证明,使用纱线可以帮助我避免此问题。

rm package-lock.json
yarn
git add -A
git commit -m "chore: use yarn"
git push heroku master

如果我决定升级服务,那么我会直接问Heroku,为什么会遇到这种情况。在此之前,这是一个好的解决方案,

本文链接:https://www.f2er.com/3046104.html

大家都在问