gpt4 book ai didi

node.js - Heroku cedar Node 应用程序 - 更新到 6.11.1 后无法推送主 Node

转载 作者:太空宇宙 更新时间:2023-11-04 00:19:04 25 4
gpt4 key购买 nike

响应 Heroku 最近的安全更新电子邮件,将 Node 服务器更新到版本 6.11.1 后,我无法再 git Push 我的本地主更改。更新后服务器和应用程序重新启动正常。

我尝试删除并重新安装所有node_modules,提交更改,并且应用程序在本地运行没有错误,但在尝试部署主 Node 时遇到相同的构建失败。我对 package.json 文件所做的唯一更改是添加了之前未指定的 npm 版本。

从日志来看,安装 Node 模块时服务器构建失败:

remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote: npm ERR! Cannot read property '0' of undefined

强制 push 是最好/好的解决方案吗?

这是完整的日志:

Counting objects: 18, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (18/18), 8.80 KiB | 0 bytes/s, done.
Total 18 (delta 13), reused 0 (delta 0)
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: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 6.11.1
remote: engines.npm (package.json): 5.3.0
remote:
remote: Downloading and installing node 6.11.1...
remote: Downloading and installing npm 5.3.0 (replacing version 3.10.10)...
remote:
remote: -----> Restoring cache
remote: Loading 2 from cacheDirectories (default):
remote: - node_modules
remote: - bower_components (not cached - skipping)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote: npm ERR! Cannot read property '0' of undefined
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /app/.npm/_logs/2017-07-20T22_54_19_003Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to app-name.
remote:
To https://git.heroku.com/app-name.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/app-name.git'

谢谢。

最佳答案

更新到 Node 6.11.1 和 npm 5.3.0 后,我收到了相同的错误消息。 heroku 支持建议我运行以下命令:

heroku plugins:install heroku-repo
heroku repo:purge_cache -a APPNAME
git commit --allow-empty -m "Purge cache"
git push heroku master

...其中“APPNAME”是我的应用程序的 heroku 标识符。

这解决了错误,我不必恢复到 npm 的早期版本。我已要求他们做出解释,但他们还没有回复(几分钟前才问过)。

2017-07-27 更新:heroku 支持人员回复称:“我们仍在研究此问题的根本原因,但似乎相当间歇性。”现在我已经安装了插件(见上文),我正在运行以下步骤来更新我的应用程序:

heroku repo:purge_cache -a APPNAME
git push heroku master

这对我来说一直可靠地工作。

关于node.js - Heroku cedar Node 应用程序 - 更新到 6.11.1 后无法推送主 Node ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45226488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com