Cloudflare Docs
Workers
Visit Workers on GitHub
Set theme to dark (⇧+D)

Get started with Wrangler

Wrangler is a command-line tool for building Cloudflare Workers.

Install

Installing Wrangler, the Workers CLI, allows you to init, dev, and publish your Workers projects.

To install wrangler, ensure you have npm installed, preferably using a Node version manager like Volta or nvm. Using a version manager helps avoid permission issues and allows you to easily change Node.js versions. Then run:

$ npm install -g wrangler

or install with yarn:

$ yarn global add wrangler

To check your Wrangler version, run:

$ wrangler --version

Authenticate

With installation complete, Wrangler will need access to a Cloudflare OAuth token to manage Workers resources on your behalf.

Run the command wrangler login, which will automate this process.

Wrangler will attempt to automatically open your web browser to complete the login process to your Cloudflare account. If you have issues completing this step or you do not have access to a browser GUI, you can copy and paste the URL generated by wrangler login in your terminal into a browser and log in.

$ wrangler login
⛅️ wrangler 2.0.7
-----------------------------------------------------
Attempting to login via OAuth...
Successfully logged in.

Open the browser, log in to your account, and select Allow. This will send an OAuth Token to Wrangler so it can deploy your scripts to Cloudflare.

Update

To update Wrangler, run:

$ npm -g install [email protected]

Note that this command will not update Wrangler in projects where it is already installed. If you already have a package.json in your directory with Wrangler installed, run:

$ npm update wrangler --save

With Wrangler successfully installed, refer to Commands and Configuration to continue building with Wrangler.