如何在安装依赖项后清除heroku中的缓存?

时间:2017-07-12 17:59:36

标签: node.js heroku heroku-cli

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

如何在heroku中禁用缓存?

1 个答案:

答案 0 :(得分:5)

感谢大家的回复。

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

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

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

    heroku config:set NPM_CONFIG_PRODUCTION=false
    
  2. 将生产设置为false,强制heroku安装所有包。

    ** Only do this if doing development.
    
    1. 默认情况下,Heroku会缓存所有依赖项,以便部署更快。

      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
      
相关问题