使用angular新建项目后,在项目下新建组件库时报错:
The new command requires to be run outside of a project, but a project definition was found at “D:\Workspace\WebstormProjects\nz-supzorro\angular.json”.
The new command requires to be run outside of a project, but a project definition was found at "D:\Workspace\WebstormProjects\nz-supzorro\angular.json".
具体的命令:
ng new nz-supzorro
,新建项目名为nz-supzorro
的项目;
cd nz-supzorro
,切换到项目目录下;
ng new library my-unit
,新建组件库,报错!
解决:
首先确定自己已经进入到项目目录下了 √
其次,检查命令,
发现新建组件库的命令应该是ng g library my-unit
,命令写错了!