Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dokku cannot find 'webpack'

I have an issue with pushing an application that uses webpack to dokku. Webpack itself is located in the devDependencies of the package.json.

Once pushed it starts installing node_modules. But once it starts to execute the 'postinstall' script it says the following:

sh: 1: webpack: not found

npm ERR! Linux 3.16.0-30-generic
npm ERR! argv "/tmp/build/.heroku/node/bin/node" "/tmp/build/.heroku/node/bin/npm" "install" "--quiet" "--userconfig" "/tmp/build/.npmrc"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] postinstall: `webpack`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'webpack'.
npm ERR! This is most likely a problem with the profortool-app package,
npm ERR! not with npm itself.

Things I tried:

  1. Use a bash script to install webpack globally first and then execute webpack.
  2. Put webpack in the 'dependencies' instead of 'devDependencies'
  3. Try to execute webpack locally within the dokku app.

None of these things worked out. Does anyone have an idea how to fix this?

Regards, Patrick van Vuuren

like image 356
Serf Avatar asked Jun 15 '26 01:06

Serf


1 Answers

I have solved the issue by placing devDependencies in normal dependencies (probably has something to do with being in production mode on dokku) and I changed the postinstall script to:

node_modules/.bin/webpack

Probably dokku has to be configured to development mode to allow dependencies to sit in devDependencies.

like image 162
Serf Avatar answered Jun 17 '26 21:06

Serf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!