素材巴巴 > 程序开发 >

angular新建library报错The new command requires to be run outside of a project, but a project definition

程序开发 2023-09-03 13:00:02

使用angular新建项目后,在项目下新建组件库时报错:

The new command requires to be run outside of a project, but a project definition was found at “D:WorkspaceWebstormProjectsnz-supzorroangular.json”.

The new command requires to be run outside of a project, but a project definition was found at "D:WorkspaceWebstormProjectsnz-supzorroangular.json".
 

在这里插入图片描述
具体的命令:
ng new nz-supzorro,新建项目名为nz-supzorro的项目;
cd nz-supzorro,切换到项目目录下;
ng new library my-unit,新建组件库,报错!

解决:
首先确定自己已经进入到项目目录下了 √
其次,检查命令,
发现新建组件库的命令应该是ng g library my-unit,命令写错了!


标签:

素材巴巴 Copyright © 2013-2021 http://www.sucaibaba.com/. Some Rights Reserved. 备案号:备案中。