Prerequisites

Python

  • Your Replit App uses Python 3.10 or above
  • You are using the poetry backend for upm. Currently, pip is not supported for this feature.
  • All of your projects’ dependencies are tracked in your pyproject.toml, and you have a current poetry.lock.

Node

  • Your project uses npm version 7 or above

Enabling Package Caching

If your Replit App follows the prerequisites above, you can try enabling package caching to speed up deploys. To do this, you need to define an environment variable in the .replit file. For Python Replit App, the variable is REPLIT_PYTHON_PACKAGE_LAYER. For Node Replit App, it’s REPLIT_NODEJS_PACKAGE_LAYER.

Set the correct environment variable in the [env] section of the .replit file.

[env]
# For Python
REPLIT_PYTHON_PACKAGE_LAYER = "1"
# or For Node
REPLIT_NODEJS_PACKAGE_LAYER = "1"

After the initial Deployment with caching enabled, the build system will cache the dependencies for quicker future Deployments.

Troubleshooting

If your Deployment fails during the Bundle or Promote steps, you may need to disable package caching. To do that, just remove the environment variable definitions from .replit.