Closed bogdan-pistol closed 6 years ago
Hi @bogdan-pistol,
I think you are getting that error because npm run build
isn't executed at the right time.
From Heroku documentation:
By default, Heroku will install all dependencies listed in package.json under dependencies and devDependencies.
After running the installation and build steps Heroku will strip out the packages declared under devDependencies before deploying the application.
Based on you logs Heroku do a npm install
which downloads all the dependencies and then directly removes the dev dependencies:
-----> Building dependencies
Installing node modules (package.json + package-lock)
> uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/build_7d3850ed3a97bc8e0eeec8819b398bb8/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
added 863 packages from 630 contributors and audited 6764 packages in 37.65s
found 0 vulnerabilities
-----> Pruning devDependencies
removed 863 packages in 12.201s
found 0 vulnerabilities
And if I'm not wrong, @symfony/webpack-encore
should be listed as a dev dependency in your package.json
file... which means that when you try to run Encore to build your app it isn't there anymore.
To fix your issue you'll have to do your npm run build
after the Building dependencies
step but before the Pruning devDependencies
one. I'm not using Heroku so I don't exactly know how to do that, but I'm sure that it should be explained somewhere in the documentation :)
Wow! Great catch! For the moment i have deactivated the pruning of devDependecies via NPM_CONFIG_PRODUCTION=false
Thanks for the prompt response!
I am deploying a Symfony4 app on Heroku. Everything worked fine up until it didn't anymore. Don't really know what to do.
The
npm run build
command seems to fail. Below is the deploy output from heroku.Heroku runs an Ubuntu 16.04 VM.
The
composer.json
file: