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?
Heroku uses the lockfiles, either the package-lock. json or yarn. lock , to install the expected dependency tree, so be sure to check those files into git to ensure the same dependency versions across environments. If you are using npm, Heroku will use npm ci to set up the build environment.
This error message means that Heroku was unable to automatically detect the type of app you're trying to deploy: Ruby, Node, Python, PHP, Java, etc. We look for signatures for each language we support (like a pom. xml file or package. json file).
By default, Heroku runs npm start while starting deployed Node. js applications, but if you would like to run some other script from your package. json instead you just need to follow one simple step. And that's it!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With