无法使用Nest CLI创建新项目 [英] Unable to create a new project with the Nest CLI

查看:952
本文介绍了无法使用Nest CLI创建新项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照教程创建嵌套项目.我已经使用以下命令安装了 Nest CLI :

I am following this tutorial to create a nest project. I have installed Nest CLI using this command:

npm i -g @nestjs/cli

我已使用以下命令检查了在本地安装的软件包列表,并发现已成功安装:

I have checked the list of packages installed locally using the following command and found that it was successfully installed:

npm list -g --depth 0

但是当我尝试使用以下命令创建新项目时,它给了我一个错误:

but when I tried to create a new project using following command it gave me an error:

nest new project-name

错误:

nest:术语"nest"不被识别为cmdlet,函数,脚本文件或 可操作的程序.检查名称的拼写,或者是否包含路径,请验证 路径正确,然后重试.

nest : The term 'nest' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

在第1行:1个字符:1

At line:1 char:1

  • 嵌套的新项目名称

  • nest new project-name


+ CategoryInfo          : ObjectNotFound: (nest:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

截屏:

为什么会这样?它出什么问题了?有人可以帮助我确定问题吗?

预先感谢

推荐答案

在大多数情况下,最好使用npx而不是安装全局npm软件包,因为您将始终使用最新版本并且不会使文件混乱系统中不需要的东西.

In most cases, it is better to use npx instead of installing global npm packages, since you'll always use the latest version and not clutter your file system with things you don't need often.

对于任何命令,只需将nest替换为npx @nestjs/cli:

Just replace nest with npx @nestjs/cli for any command:

npx @nestjs/cli new project-name

这篇关于无法使用Nest CLI创建新项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆