How to innstall Cloudflare wrangler, npm and Node.js on Mac OSX
Install Node.js via homebrew
brew install node
Update the shell
bb ~/.zshrc
bb ~/.bash_profile
Add the following values:
# Node.js and npm
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
export PATH="/usr/local/bin:${PATH}"
PATH="/usr/local/bin:${PATH}"
Restart Shell
source ~/.zshrc
source ~/.bash_profile
Verify that Node.js and npm is installed
-
Test Node
To see if Node is installed, type
node -v
in Terminal. This should print the version number so you’ll see something like this: v0.10.31
.
-
Test NPM
To see if NPM is installed, type
npm -v
in Terminal. This should print the version number so you’ll see something like this 1.4.27
Install wrangler with npm
npm i @cloudflare/wrangler -g
Once you have installed Wrangler, deploy your first Cloudflare Worker.
$ wrangler generate --site my-worker
$ cd my-worker
$ # update your wrangler.toml with your Cloudflare Account ID
$ wrangler config
$ wrangler publish
References for post about Cloudflare Wrangler and Node.js
Wrangler project page on GitHub
Hosting Static WordPress Sites on Cloudflare Workers
Setting up Node.js and npm on Mac OSX
Install Node.js and npm using Homebrew on OS X and macOS