问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/27519313/how-to-have-package-json-not-at-top-level-of-heroku-app