Cloudflare 中文文档
Workers
Workers
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

Migrate from Wrangler v1 to Wrangler v2

This document describes the steps to migrate a project from Wrangler v1 to Wrangler v2. Before updating your Wrangler version, review and complete Migrate webpack projects from Wrangler version 1 if it applies to your project.

Wrangler v2 ships with new features and improvements that may require some changes to your configuration.

The CLI itself will guide you through the upgrade process.

​​ Update Wrangler version

​​ 1. Uninstall Wrangler v1

If you had previously installed Wrangler v1 globally using npm, you can uninstall it with:

If you used Cargo to install Wrangler v1, you can uninstall it with:

​​ 2. Install Wrangler

Now, install the latest version of Wrangler.

​​ 3. Verify your install

To check that you have installed the correct Wrangler version, run:

​​ Test Wrangler v2 on your previous projects

Now you will test that Wrangler v2 can build your Wrangler v1 project. In most cases, it will build just fine. If there are errors, the command line should instruct you with exactly what to change to get it to build.

If you would like to read more on the deprecated wrangler.toml fields that cause Wrangler v2 to error, refer to Deprecations.

Run the wrangler dev command. This will show any warnings or errors that should be addressed. Note that in most cases, the messages will include actionable instructions on how to resolve the issue.

  • Errors need to be fixed before Wrangler can build your Worker.
  • In most cases, you will only see warnings. These do not stop Wrangler from building your Worker, but consider updating the configuration to remove them.

Here is an example of some warnings and errors:

​​ Deprecations

Refer to Deprecations for more details on what is no longer supported.