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

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

问题描述

主题:Heroku
问题:在heroku中安装我的节点js应用程序后,我对package.json做了一些更改。现在,当我试图再次推送更改时,未安装新的依赖关系。 Heroku正在从缓存中选取依赖关系。



如何在heroku中禁用缓存?

解决方案<感谢所有的回应。



经过大量的搜索和花费时间在我的问题上,我能够解决我的问题。
我认为如果有人面临类似的困境,最好发表一个答案。



以下是文档,我找到了我的答案 https://devcenter.heroku.com/articles/nodejs-support


  1. 默认情况下,在heroku中生产设置为true。这就是为什么只有依赖被安装。 (& sk dev devDependencies)

      heroku config:set NPM_CONFIG_PRODUCTION = false 

将生产设置为false,以强制heroku安装所有软件包。

  **只有在进行开发时才这样做。 




  1. 默认情况下,Heroku缓存所有的依赖关系,以便部署更快。

      heroku config:set NODE_MODULES_CACHE = false 

    $ git commit -am'禁用node_modules缓存'--allow-empty

    $ git push heroku master

    **只有在package.json中添加新依赖项时才可以使用



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.

How to disable cache in heroku ?

解决方案

Thanks all for responding.

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.

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

  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
    

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

** Only do this if doing development.

  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天全站免登陆