I want to build my nextjs app using npm install --legacy-peer-deps. How can I do that using App Platform
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!
Did you find the answer, I am running into same issue. In Netify youu can use a env var called NPM_FLAGS and you set to --legacy-peer-deps or --force but that method did not work for DO !
I am guessing we may need to do it from package.json
here’s what i am working with:
{
"name": "blooming-brands-ar-v01",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "npm install --legacy-peer-deps",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@motionone/utils": "^10.18.0",
"@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-select": "^2.1.5",
"@radix-ui/react-slot": "^1.1.1",
"@types/react-slick": "^0.23.13",
"axios": "^1.7.9",
"bcryptjs": "^2.4.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cookie-parser": "^1.4.7",
"cors": "^2.8.5",
"framer-motion": "^12.0.3",
"js-confetti": "^0.12.0",
"jsonwebtoken": "^9.0.2",
"lucide-react": "^0.474.0",
"motion": "^12.0.5",
"mysql2": "^3.12.0",
"next": "15.1.6",
"next-intl": "^3.26.3",
"nodemailer": "^6.10.0",
"react": "^19.0.0",
"react-calendly": "^4.3.1",
"react-countup": "^6.5.3",
"react-dom": "^19.0.0",
"react-icons": "^5.4.0",
"react-slick": "^0.30.3",
"sequelize": "^6.37.5",
"slick-carousel": "^1.8.1",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@types/axios": "^0.9.36",
"@types/bcryptjs": "^2.4.6",
"@types/cookie-parser": "^1.4.8",
"@types/jsonwebtoken": "^9.0.8",
"@types/node": "^20.17.16",
"@types/nodemailer": "^6.4.17",
"@types/react": "^19.0.8",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.1.6",
"postcss": "^8",
"react-marquee-text": "^1.0.4",
"tailwindcss": "^3.4.1",
"typescript": "^5.7.3"
}
}
I might have found the answer, this is what worked for me and I answered else where:
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.