安装依赖项后如何清理heroku中的缓存? [英] How to clean cache in heroku after installing dependencies?

查看:29
本文介绍了安装依赖项后如何清理heroku中的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主题:Heroku问题:在 heroku 中安装我的 node js 应用程序后,我在 package.json 中做了一些更改.现在,当我再次尝试推送更改时,没有安装新的依赖项.Heroku 正在从缓存中选择依赖项.

Topic : Heroku Problem : After installing my node js application in heroku, I made some changes in package.json. Now, when I am trying to push changes again, new dependencies are not getting installed. Heroku is picking the dependencies from cache.

如何在heroku中禁用缓存?

How to disable cache in heroku ?

推荐答案

感谢大家的回复.

经过大量谷歌搜索和花时间解决我的问题后,我能够解决我的问题.我认为如果有人面临类似的困境,最好发布答案.

After much googling and spending time on my issue, I was able to solve my problem. I thought it would be better to post an answer if anyone faces the similar dilemma.

下面是文档,在那里我找到了我的答案 https://devcenter.heroku.com/文章/nodejs-support

Below is the documentation, where I found my answer https://devcenter.heroku.com/articles/nodejs-support

  1. 默认情况下,在 heroku 生产中设置为 true.这就是为什么只安装依赖项的原因.( & 跳过 devDependencies )

  1. By default, in heroku production is set to true. That's why only dependencies get installed. ( & skips devDependencies )

heroku config:set NPM_CONFIG_PRODUCTION=false

将 production 设置为 false,以强制 heroku 安装所有软件包.

Set production to false, to force heroku to install all packages.

** Only do this if doing development.

  1. 默认情况下,Heroku 会缓存所有依赖项,因此部署速度更快.

  1. Heroku, by default, caches all the dependencies, so that the deployment is faster.

heroku config:set NODE_MODULES_CACHE=false

$ git commit -am 'disable node_modules cache' --allow-empty

$ git push heroku master

** Preferable only if new dependencies are added in package.json

这篇关于安装依赖项后如何清理heroku中的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆