Install devDependencies on Heroku

前端 未结 5 1705
南笙
南笙 2020-12-23 12:30

I would like to have Heroku build my app after I push it so that I don\'t have to push the build folder up every time I make a change. However heroku only installs the depen

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 13:21

    scripts": {
      ...
      "heroku-prebuild": "npm install --only=dev"
    }
    

    This was enough for me. Thanks to PixnBits for the hint about heroku-prebuild. Also - my problem was with babel. I ended up moving babel-preset-es2015 and other presets into dependencies otherwise babel complained about presets.

    Update: 8/11/2017 I've been having trouble with this. It seems like things have changed (and npm is on 5.3 now). But what I see is that the heroku-prebuild script is getting run, and then the post-install script is getting run (but I was only trying to install -dev).

    So what I have been doing that works is to just run:

    heroku config:set NPM_CONFIG_PRODUCTION=false
    

    And just leave it set that way. I'd love a better solution.

提交回复
热议问题