2017-11-07 14:39:07 +11:00
|
|
|
---
|
|
|
|
|
id: install
|
|
|
|
|
title: Install
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Install with `yarn`:
|
|
|
|
|
|
2017-12-06 03:48:11 +01:00
|
|
|
```bash
|
2017-11-07 14:39:07 +11:00
|
|
|
yarn add prettier --dev --exact
|
2018-02-01 01:46:27 +01:00
|
|
|
# or globally
|
2017-11-07 14:39:07 +11:00
|
|
|
yarn global add prettier
|
|
|
|
|
```
|
|
|
|
|
|
2017-11-22 19:27:40 +08:00
|
|
|
_We're using `yarn` but you can use `npm` if you like:_
|
2017-11-07 14:39:07 +11:00
|
|
|
|
2017-12-06 03:48:11 +01:00
|
|
|
```bash
|
2017-11-07 14:39:07 +11:00
|
|
|
npm install --save-dev --save-exact prettier
|
|
|
|
|
# or globally
|
|
|
|
|
npm install --global prettier
|
|
|
|
|
```
|
|
|
|
|
|
2017-11-22 19:27:40 +08:00
|
|
|
> We recommend pinning an exact version of prettier in your `package.json` as we introduce stylistic changes in patch releases.
|
2020-03-23 14:39:06 +02:00
|
|
|
|
|
|
|
|
If you use `npx` to run Prettier, the version should be pinned like this:
|
|
|
|
|
|
|
|
|
|
```bash
|
2020-04-21 20:05:11 +03:00
|
|
|
npx prettier@2.0.5 . --write
|
2020-03-23 14:39:06 +02:00
|
|
|
```
|