I followed the documentation to create my first NestJS project.
Installing the Nest CLI with the command npm i -g @nestjs/cli
was successful.
The output was:
+ @nestjs/[email protected]
updated 1 package in 11.326s
However, when I try to scaffold a project with the Nest CLI:
nest new project-name
I get the following error:
zsh: command not found: nest
Some details about my environment:
The Nest CLI is a command-line interface tool that helps you to initialize, develop, and maintain your Nest applications. It assists in multiple ways, including scaffolding the project, serving it in development mode, and building and bundling the application for production distribution.
First, we install two packages @nestjs/cli and npm-check-updates globally or as so-called devDependency. In this article, we go for the global approach. We need npm-check-updates because the NestJS CLI doesn't cover every single package from NestJS.
NestJS is a framework for building efficient and scalable Node. js server-side applications built with and fully supporting TypeScript. It uses robust HTTP Server frameworks like Express or Fastify. Nest provides a level of abstraction above the common Node.
nest build is a wrapper on top of the standard tsc compiler (for standard projects) or the webpack compiler (for monorepos). It does not add any other compilation features or steps except for handling tsconfig-paths out of the box.
Use npx @nestjs/cli
instead of nest
e.g. npx @nestjs/cli g controller pages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With