Configure NPM to be able to use PWA Studio

Last update: 2022-12-14

Progressive Web Apps (PWA) Studio is a new project available for Adobe Commerce on cloud infrastructure 2.3.x or later. To be able to use and install PWA Studio, you need to set the NPM package manager version to 5.x or later to get support for Node.js 8.x. This is done in the hooks:build section of the configuration file.

Environment and technologies

  • Adobe Commerce on cloud infrastructure 2.3.X
  • PWA for Adobe Commerce

Set NPM version: steps

To set the needed NPM version, specify it in the configuration file. Follow these steps:

  1. On your local development environment, locate the configuration file.

  2. Open the file for editing using your plain text editor or IDE.

  3. Set the required version in the hooks:build section. In the following example, the configuration is set to install NPM v9.5.0, the highest available at the moment (February 4, 2019):

        build: |
            unset NPM_CONFIG_PREFIX
            curl -o- | bash
            export NVM_DIR="$HOME/.nvm"
            [ -s "$NVM_DIR/" ] && \. "$NVM_DIR/"
            nvm install 9.5.0

    If you want to run Node.JS in your application and not just in your build, please add the following commands to change your build hook:

    echo ‘unset NPM_CONFIG_PREFIX’ >> .environment
    echo ‘export NO_UPDATE_NOTIFIER=1’ >> .environment
    echo ‘export NVM_DIR=“$MAGENTO_CLOUD_DIR/.nvm”’ >> .environment
    echo ‘[ -s “$NVM_DIR/” ] && . “$NVM_DIR/”’ >> .environment

  4. Save changes in the file.

  5. Git push the edited file to your integration environment.

The changes come into effect after you Git push the updated YAML file to the environment.

On this page