Synchro's avatar

Mix in production missing laravel-mix package

The docs suggest that putting laravel-mix in devDependencies is its preferred location as webpack will find it there even in prod mode, so that's where it is. However, if I run:

npm install --production
npm run prod

It fails with this error:

> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

events.js:353
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

I assume that this is because node_modules/laravel-mix/ doesn't exist and thus nor does the config file the command mentions. I don't see any reason this would work!

Is putting laravel-mix in devDependencies just wrong?

0 likes
1 reply
Synchro's avatar

Moving all the things that are needed to run those commands out of devDependencies worked, so I guess putting them there to start with was bad advice. Could have done without that!

Please or to participate in this conversation.