8

I have this app that deploys to heroku:

https://github.com/justin808/react-webpack-rails-tutorial

http://react-webpack-rails-tutorial.herokuapp.com/

The technique is described here: http://www.railsonmaui.com/blog/2014/10/02/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/

Currently, package.json is at the root level of the project.

How do move the /package.json and /node_modules to be inside of the /webpack directory?

I.e., how do I tell the node buildpack where to look for package.json?

justingordon
  • 12,553
  • 12
  • 72
  • 116
  • Your server seems to be implemented in Ruby. Why do you need the package.json to be in the root folder? – britter Oct 26 '15 at 11:13

1 Answers1

3

The fix is to use this in package.json:

  "scripts": {
    "postinstall": "cd client && npm install",

You can see the full details here: https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/package.json#L10

justingordon
  • 12,553
  • 12
  • 72
  • 116
  • 1
    All of my codes are not placed in the root of the repo. Actually, they are in a directory. How can I tell Heroku search for package.json in this folder instead of searching in the root of the repo? – E A May 28 '18 at 16:17
  • Were you able to solve this? @EmadAghayi – ertemishakk Dec 27 '21 at 07:23