I have an automated deployment tool that generates a React or Angular project, uploads it to Azure App Service, and then restores node_modules to reduce build time.

To avoid running npm install on every deployment, I store a prebuilt node_modules.zip (~60 MB) in Azure Blob Storage.
My workflow is:

  1. Download node_modules.zip

  2. Extract it inside Kudu (App Service console) under /tmp/...

  3. Copy the extracted folder to /home/site/wwwroot/<project>/node_modules

The problem:
Extracting + copying this ZIP takes more time than running npm install, even though the whole idea was to speed up deployment.

What I tried

  • Using node_modules.zip

  • Extracting to /tmp then copying to the project directory

  • Trying different unzip packages (unzipper, adm-zip, etc.)

  • Using Kudu console and Azure CLI

Issues Observed

  • Azure App Service file system is slow with thousands of small files

  • Zip extraction of node_modules is extremely slow

  • Copying the folder doubles the delay

  • End result: npm install actually finishes faster

    My Question

    How can I speed up the node_modules restore process on Azure App Service?

    I want to avoid running npm install every time, but extracting a ZIP of node_modules is even slower. What’s the best practice to quickly restore dependencies on Azure App Service?

    Additional Notes

    • App Service is Linux-based

    • Deployment tool is using Node.js

    • React and Angular builds are working, this issue is only with node_modules restore

    • I am open to alternatives like tar.gz, npm cache, npm ci, etc.

    What I am looking for

    • Better format to store node_modules (tar.gz?)

    • Faster extraction method

    • Extract directly to destination without copy?

    • Alternative approaches (npm cache or npm ci)

    • Any best practices for dependency restore in Azure App Services

2 Replies 2

Perhaps pnpm can be an option. https://pnpm.io/continuous-integration

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.