You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<palign="center">A progressive <ahref="http://nodejs.org"target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
Copy file name to clipboardExpand all lines: content/cli/overview.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,16 @@ The [Nest CLI](https://github.com/nestjs/nest-cli) is a command-line interface t
4
4
5
5
#### Installation
6
6
7
-
**Note**: In this guide we describe using [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to install packages, including the Nest CLI. Other package managers may be used at your discretion. With npm, you have several options available for managing how your OS command line resolves the location of the `nest` CLI binary file. Here, we describe installing the `nest` binary globally using the `-g` option. This provides a measure of convenience, and is the approach we assume throughout the documentation. Note that installing **any** `npm` package globally leaves the responsibility of ensuring they're running the correct version up to the user. It also means that if you have different projects, each will run the **same** version of the CLI. A reasonable alternative is to use the [npx](https://github.com/npm/npx) program (or similar features with other package managers) to ensure that you run a **managed version** of the Nest CLI. We recommend you consult the [npx documentation](https://github.com/npm/npx) and/or your DevOps support staff for more information.
7
+
**Note**: In this guide we describe using [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to install packages, including the Nest CLI. Other package managers may be used at your discretion. With npm, you have several options available for managing how your OS command line resolves the location of the `nest` CLI binary file. Here, we describe installing the `nest` binary globally using the `-g` option. This provides a measure of convenience, and is the approach we assume throughout the documentation. Note that installing **any** `npm` package globally leaves the responsibility of ensuring they're running the correct version up to the user. It also means that if you have different projects, each will run the **same** version of the CLI. A reasonable alternative is to use the [npx](https://github.com/npm/cli/blob/latest/docs/lib/content/commands/npx.md) program, built into the `npm` cli (or similar features with other package managers) to ensure that you run a **managed version** of the Nest CLI. We recommend you consult the [npx documentation](https://github.com/npm/cli/blob/latest/docs/lib/content/commands/npx.md) and/or your DevOps support staff for more information.
8
8
9
9
Install the CLI globally using the `npm install -g` command (see the **Note** above for details about global installs).
10
10
11
11
```bash
12
12
$ npm install -g @nestjs/cli
13
13
```
14
14
15
+
> info **Hint** Alternatively, you can use this command `npx @nestjs/cli@latest` without installing the cli globally.
16
+
15
17
#### Basic workflow
16
18
17
19
Once installed, you can invoke CLI commands directly from your OS command line through the `nest` executable. See the available `nest` commands by entering the following:
@@ -36,6 +38,8 @@ $ npm run start:dev
36
38
37
39
In your browser, open [http://localhost:3000](http://localhost:3000) to see the new application running. The app will automatically recompile and reload when you change any of the source files.
38
40
41
+
> info **Hint** We recommend using the [SWC builder](/recipes/swc) for faster builds (10x more performant than the default TypeScript compiler).
42
+
39
43
#### Project structure
40
44
41
45
When you run `nest new`, Nest generates a boilerplate application structure by creating a new folder and populating an initial set of files. You can continue working in this default structure, adding new components, as described throughout this documentation. We refer to the project structure generated by `nest new` as **standard mode**. Nest also supports an alternate structure for managing multiple projects and libraries called **monorepo mode**.
@@ -86,11 +90,21 @@ Run `nest <command> --help` for any of the following commands to see command-spe
86
90
87
91
See [usage](/cli/usages) for detailed descriptions for each command.
|`new`|`n`| Scaffolds a new _standard mode_ application with all boilerplate files needed to run. |
96
+
|`generate`|`g`| Generates and/or modifies files based on a schematic. |
97
+
|`build`|| Compiles an application or workspace into an output folder. |
98
+
|`start`|| Compiles and runs an application (or default project in a workspace). |
99
+
|`add`|| Imports a library that has been packaged as a **nest library**, running its install schematic. |
100
+
|`info`|`i`| Displays information about installed nest packages and other helpful system info. |
101
+
102
+
#### Requirements
103
+
104
+
Nest CLI requires a Node.js binary built with [internationalization support](https://nodejs.org/api/intl.html) (ICU), such as the official binaries from the [Node.js project page](https://nodejs.org/en/download). If you encounter errors related to ICU, check that your binary meets this requirement.
105
+
106
+
```bash
107
+
node -p process.versions.icu
108
+
```
109
+
110
+
If the command prints `undefined`, your Node.js binary has no internationalization support.
Copy file name to clipboardExpand all lines: content/cli/scripts.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ The `nest` command is an OS level binary (i.e., runs from the OS command line).
16
16
17
17
#### Build
18
18
19
-
`nest build` is a wrapper on top of the standard `tsc` compiler (for [standard projects](https://docs.nestjs.com/cli/overview#project-structure)) or the webpack compiler (for [monorepos](https://docs.nestjs.com/cli/overview#project-structure)). It does not add any other compilation features or steps except for handling `tsconfig-paths` out of the box. The reason it exists is that most developers, especially when starting out with Nest, do not need to adjust compiler options (e.g., `tsconfig.json` file) which can sometimes be tricky.
19
+
`nest build` is a wrapper on top of the standard `tsc` compiler or `swc` compiler (for [standard projects](https://docs.nestjs.com/cli/overview#project-structure)) or the webpack bundler using the `ts-loader` (for [monorepos](https://docs.nestjs.com/cli/overview#project-structure)). It does not add any other compilation features or steps except for handling `tsconfig-paths` out of the box. The reason it exists is that most developers, especially when starting out with Nest, do not need to adjust compiler options (e.g., `tsconfig.json` file) which can sometimes be tricky.
20
20
21
21
See the [nest build](https://docs.nestjs.com/cli/usages#nest-build) documentation for more details.
|`--package-manager [package-manager]`| Specify package manager. Use `npm`, `yarn`, or `pnpm`. Package manager must be installed globally.<br/> Alias: `-p`|
35
-
|`--language [language]`| Specify programming language (`TS` or `JS`).<br/> Alias: `-l`|
36
-
|`--collection [collectionName]`| Specify schematics collection. Use package name of installed npm package containing schematic.<br/> Alias: `-c`|
|`--package-manager [package-manager]`| Specify package manager. Use `npm`, `yarn`, or `pnpm`. Package manager must be installed globally.<br/> Alias: `-p`|
35
+
|`--language [language]`| Specify programming language (`TS` or `JS`).<br/> Alias: `-l`|
36
+
|`--collection [collectionName]`| Specify schematics collection. Use package name of installed npm package containing schematic.<br/> Alias: `-c`|
37
37
|`--strict`| Start the project with the following TypeScript compiler flags enabled: `strictNullChecks`, `noImplicitAny`, `strictBindCallApply`, `forceConsistentCasingInFileNames`, `noFallthroughCasesInSwitch`|
|`--path [path]`| Path to `tsconfig` file. <br/>Alias `-p`|
113
+
|`--config [path]`| Path to `nest-cli` configuration file. <br/>Alias `-c`|
114
+
|`--watch`| Run in watch mode (live-reload).<br /> If you're using `tsc` for compilation, you can type `rs` to restart the application (when `manualRestart` option is set to `true`). <br/>Alias `-w`|
115
+
|`--builder [name]`| Specify the builder to use for compilation (`tsc`, `swc`, or `webpack`). <br/>Alias `-b`|
116
+
|`--webpack`| Use webpack for compilation (deprecated: use `--builder webpack` instead). |
117
+
|`--webpackPath`| Path to webpack configuration. |
0 commit comments