when building in Heroku the Heroku branch I get the error sh: 1: webpack: not found. Is there any extra configuration needed for this to work?
Below is the full log. Thanks a lot
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 4.1.1
engines.npm (package.json): unspecified (use default)
Downloading and installing node 4.1.1...
Using default npm version: 2.14.4
-----> Restoring cache
Skipping cache restore (new runtime signature)
-----> Building dependencies
Pruning any extraneous modules
Installing node modules (package.json)
> [email protected] postinstall /tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME/node_modules/react-router
> node ./npm-scripts/postinstall.js
> [email protected] postinstall /tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME/node_modules/history
> node ./npm-scripts/postinstall.js
> [email protected] postinstall /tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME
> webpack --display-error-details --config webpack/prod.config.js
sh: 1: webpack: not found
npm ERR! Linux 3.13.0-79-generic
npm ERR! argv "/tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME/.heroku/node/bin/node" "/tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME/.npmrc"
npm ERR! node v4.1.1
npm ERR! npm v2.14.4
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] postinstall: `webpack --display-error-details --config webpack/prod.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'webpack --display-error-details --config webpack/prod.config.js'.
npm ERR! This is most likely a problem with the react-redux-universal-hot-example package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack --display-error-details --config webpack/prod.config.js
npm ERR! You can get their info via:
npm ERR! npm owner ls react-redux-universal-hot-example
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/build_356f620aef3b3ab00f4cd98aea35f236/MY_APP_NAME/npm-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app
it seems the problem is webpack's dependencies need to be in the dependencies section of the package.json file. I created this pull request https://github.com/erikras/react-redux-universal-hot-example/pull/1028 to fix it.
Heroku build works after applying these changes, but the built website is broken (I guess because the branch has not been updated lately). Anyway, I hope this helps someone.
You can also simply set NPM_CONFIG_PRODUCTION=false.
:sweat: yep, closing this
Most helpful comment
You can also simply set NPM_CONFIG_PRODUCTION=false.