Run npm install (first time only)
npm run build
You can rebuild all the assets at once by executing this command from the project root:
./tools/assets/build.sh # or alternatively, since 1.7.8: make assets
You can also make webpack listen for changes and compile only what’s needed as you work on your files:
npm run watch
Rebuild your changes before committing.
The “watch” build will optimize your assets for development. Please remember to rebuild for production when you are done using
npm run build.
npm install fails with error:
Failed at the ... postinstall script.:
You may be using an old version or one we don’t support yet. Currently on 1.7.8, every folders containing a package.json is compatible with node 12. How we manage to work with this, as well as working on previous PrestaShop version, is that we use a tool to easily swap between node version.
There are a lot of tools able to do this. At PrestaShop, we mainly use the ‘n’ package or nvm.
This is pretty easy to use, when you are working on a directory which need an older or newer node version, use one of these tools to switch and then
npm install && npm run build.