nest Command not found
Solution 1
Use npx @nestjs/cli
instead of nest
e.g. npx @nestjs/cli g controller pages
Solution 2
I was also getting the same console error when npm installing!
Erro was
@nestjs/cli
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@nestjs/cli npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@nestjs npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"<8.10.0"} (current: {"node":"12.14.1","npm":"6.13.4"}) npm WARN notsup Not compatible with your version of node/npm: [email protected]
How I wasn able to install => Solution
sudo npm install -g @nestjs/cli
Solution 3
I was having the same issue, what I did was:
Installed the latest node with npm install npm@latest -g
and then added the following to my .bash_profile
alias nest="/usr/local/Cellar/node/11.9.0/bin/nest"
Tested with nest --version
and it worked.
For some reason the path is not being called correctly, hope it helps.
Solution 4
Following command works in my windows 10
node -v
v14.16.0
npm -v
6.14.11
npx @nestjs/cli new project-name
Joël Sonderegger
Updated on June 18, 2022Comments
-
Joël Sonderegger almost 2 years
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:
- OSX
- iTerm
- npm version 6.5.0
-
Joël Sonderegger about 5 yearsStill the same outcome. What worked is to add
alias nest="/usr/local/lib/node_modules/node/lib/node_modules/node/lib/node_modules/@nestjs/cli/bin/nest.js
to my~/.zshrc
file. But not sure it is the best solution as a future npm will need an additional alias. -
Jonathan Nielsen about 4 yearsPlease note that this wont work since he's using zsh and not bash. He need to do the equivalent for his ~/.zshrc.
-
Mooncake over 2 yearsNever, ever, use SUDO with NPM as it may lead to security issues
-
ikoza almost 2 yearscare to elaborate on that? Anyway, installing a package globally requires elevated rights. Is there a way around this?
-
ikoza almost 2 yearsok, here it is: github.com/sindresorhus/guides/blob/main/…