Once you set the directory in which the component needs to be created(src/lib) in terminal, you should provide the component name as follows with out any path
ng generate component test
this might be throw an error saying
Could not find an NgModule. Use the skip-import option to skip
importing in NgModule.
then try as follows
ng generate component test --skip-import
If in case the above solution are not working, Please install following extention for vs code ide Angular Files. which will allow you to create the components from a context menu.