Report this

What is the reason for this report?

install && building with --legacy-peer-deps in app platform

Posted on May 8, 2025

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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.