How to Upgrade Your NodeJS Buildpack in App Platform

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.


App Platform automatically deploys new apps using the latest Node.js buildpack. However, if you created your app before 17 September 2024, your app likely uses the [legacy Node.js buildpack], and we recommend upgrading it to use the new Heroku Node.js Buildpack. The new buildpack includes security updates and new features, such as custom caching.

You can verify which buildpack your app uses by going to the Apps page in the DigitalOcean Control Panel and clicking your app. Click the Settings tab and scroll down to the Build Phase section. If the Node.js buildpack listed is Node.js v0.4.1, your app uses the legacy buildpack.

To change your app’s Node.js buildpack, go to your Apps page in the control panel and click your app. Click the Settings tab, scroll to the App Spec section, and click the Edit button. Here, you can download the spec to edit it in your preferred text editor or edit the spec directly in the control panel.

Next, add a feature field to the spec and set the value to new-nodejs-buildpack=true, like this:

    
        
            
...
name: example-app
region: nyc
features:
    - new-nodejs-buildpack=true
services:
- environment_slug: node-js
  github:
    branch: master
    deploy_on_push: true
    repo: example/app-repo
  http_port: 8080
  instance_count: 2
  instance_size_slug: professional-xs
  name: reactions
  run_command: npm start
  source_dir: /

        
    

If you edited the spec in the control panel, click Save to update your app. If you downloaded the spec, instead click Upload File, select your updated spec, and then click Replace. Either way, this automatically triggers a redeployment with the new buildpack.

The new Node.js buildpack runs npm run build (yarn build or pnpm build) by default and build_command runs after this build step.

If you’re using custom build command, you need to remove this build_command from the app spec and add this custom build command to your app’s build script.