Unable to create a new project with the Nest CLI

不羁的心 提交于 2019-12-11 16:19:00

问题


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

Error:

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.

At line:1 char:1

  • nest new project-name

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

Screenshot:

Why it is so? What's wrong with it? Can someone assist me in identifying the issue?

Thanks in advance


回答1:


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.

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

npx @nestjs/cli new project-name


来源:https://stackoverflow.com/questions/57266622/unable-to-create-a-new-project-with-the-nest-cli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!