By lennaz
Hello, i tried many ways to run npm install --legacy-peer-deps && npm run build in app platform, but it looks the command is ignored, any suggestion?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya, @lennaz
If you’re using a Dockerfile, you should handle it directly in the Docker build steps instead. Otherwise, for non-Docker apps, the Build Command field is the correct place
https://docs.digitalocean.com/products/app-platform/how-to/build-run-commands/
Regards
Hi @lennaz
I believe the command is run at the end of the build as indicated here:
[2025-05-31 16:18:29] › configuring custom build command to be run at the end of the build:
[2025-05-31 16:18:29] │ npm install --legacy-peer-deps && npm run build
I tried with a custom command, but it is executed too late in the process.
However you can add a .npmrc
to your project with the following command:
npm config --location=project set legacy-peer-deps true
Remember to commit it and push it. That seems to work, since we can now influence the context of the first npm execution.
Some more resource material for you:
Let me know if this works or not.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.