Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
use node_modules by default, clarify README
Browse files Browse the repository at this point in the history
  • Loading branch information
xortive committed Feb 25, 2021
1 parent f0e3027 commit d7d2578
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,24 @@ You have many options to install wrangler!

### Install with `npm`

We strongly recommend you install `npm` with a Node version manager like [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating), which will allow `wrangler` to install configuration data in a global `node_modules` directory in your user's home directory, without requiring that you run as `root`.
We strongly recommend you install `npm` with a Node version manager like [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating), which puts the global `node_modules` in your home directory to eliminate permissions issues with `npm install -g`. Distribution-packaged `npm` installs often use `/usr/lib/node_modules` (which is root) for globally installed `npm` packages, and running `npm install -g` as `root` prevents `wrangler` from installing properly.

Once you've installed `nvm`, run:

Once you've installed `nvm` and configured your system to use the `nvm` managed node install, run:

```bash
npm i @cloudflare/wrangler -g
```

If you are running an ARM based system (eg Raspberry Pi, Pinebook) you'll need to use the `cargo` installation method listed below to build wrangler from source.

#### Specify binary location

In case you need `wrangler`'s npm installer to place the binary in a non-default location (such as when using `wrangler` in CI), you can use the following configuration options to specify an install location:

- Environment variable: `WRANGLER_INSTALL_PATH`
- NPM configuration: `wrangler_install_path`

#### Specify binary site URL

In case you need to store/mirror binaries on premise you will need to specify where wrangler should search for them by providing any of the following:
Expand Down
8 changes: 4 additions & 4 deletions npm/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const getBinary = () => {
const version = require("./package.json").version;
const url = getBinaryURL(version, platform);

const useCwd = !!process.env.WRANGLER_USE_CWD;
const customPath = process.env.WRANGLER_INSTALL_PATH;
const altPath = useCwd ? process.cwd() : !!customPath ? customPath : false;
const installDirectory = join(altPath || os.homedir(), ".wrangler");
const customPath =
process.env.WRANGLER_INSTALL_PATH ||
process.env.npm_config_wrangler_install_path;
const installDirectory = join(customPath || __dirname, "wrangler");
return new Binary(url, { name: "wrangler", installDirectory });
};

Expand Down

0 comments on commit d7d2578

Please sign in to comment.