angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Schematic "ng-new" not found in collection "@schematics/angular".

Open npahalZenways opened this issue 8 years ago • 25 comments

Versions

Angular CLI: 6.0.1 Node: 8.9.1 npm: 5.5.1



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.1
Node: 8.9.1
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.1
@angular-devkit/core         0.6.1
@angular-devkit/schematics   0.6.1
@schematics/angular          0.6.1
@schematics/update           0.6.1
rxjs                         6.1.0
typescript                   2.7.2

Repro steps

  • Step 1 Update Angular CLI from version 1.7.6 to 6.0.1 using command "npm install -g @angular/cli"
  • Step 2 Use command "ng new my-new-app" to create a new application
  • Step 3

Observed behavior

Generates an error:

Schematic "ng-new" not found in collection "@schematics/angular". Error: Schematic "ng-new" not found in collection "@schematics/angular". at SchematicEngine.createSchematic (C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\engine\engine.js:155:23) at CollectionImpl.createSchematic (C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\engine\collection.js:12:29) at NodeWorkflow.execute (C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\tools\workflow\node-workflow.js:69:38) at Promise (C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\models\schematic-command.js:140:22) at new Promise () at NewCommand.runSchematic (C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\models\schematic-command.js:139:16) at NewCommand. (C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\commands\new.js:77:25) at Generator.next () at C:\Users\pahal\AppData\Roaming\npm\node_modules@angular\cli\commands\new.js:7:71 at new Promise ()

<!-- Normally this includes a stack trace and some more information. -->

Desired behavior

It should create a new angular application.

Mention any other details that might be useful (optional)

npahalZenways avatar May 15 '18 06:05 npahalZenways

I am having the same issue. I have tried uninstalling and installing again to no avail. npm uninstall -g @angular/cli npm cache verify npm install -g @angular/cli@latest(I have tried with 6.0.0 too)

/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

[email protected] install /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents node install

[fsevents] Success: "/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

@angular/[email protected] postinstall /usr/local/lib/node_modules/@angular/cli node ./bin/ng-update-message.js

ng new test

screen shot 2018-05-15 at 22 22 53

ng -v screen shot 2018-05-15 at 22 58 43

seaBubble avatar May 15 '18 12:05 seaBubble

I have this issue too, when upgrade global angular cli to 6.0.1.

I just find out some workaround

Remove the node_modules folder in your home directory.

😸

kyoz avatar May 15 '18 14:05 kyoz

But if I remove the whole node modules all my global dependecies will be gone right?not only angular

seaBubble avatar May 15 '18 21:05 seaBubble

I have same issue only in local package (CMD C:Users) angular-devkit/core error

But it works fine in the global package (CMD as admin) ? no errors can create projects.

alvics avatar May 15 '18 22:05 alvics

I've tried it using CMD as administrator but it still throws the exact error.

npahalZenways avatar May 16 '18 05:05 npahalZenways

Can someone please provide their global configuration files.

all of the following from your home directory angular-config.json, .angular-cli.json, angular.json, .angular.json

Thank you!

Brocco avatar May 16 '18 20:05 Brocco

I had this issue and as @banminkyoz said removing the folder node_modules in my home directory solved the problem.

nbastidas avatar May 16 '18 22:05 nbastidas

I'm getting this as well right now. Here's my environment @Brocco :

Node: 9.11.1
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    <error>
@angular-devkit/core         <error>
@angular-devkit/schematics   <error>
@schematics/angular          0.6.3
@schematics/update           <error>
rxjs                         <error>
typescript                   2.7.2

~/angular-config.json: /Users/stephenfluin/angular-config.json: No such file or directory

~/.angular-cli.json:

{
  "packageManager": "yarn"
}

~/angular.json: /Users/stephenfluin/angular.json: No such file or directory

~/.angular.json: /Users/stephenfluin/.angular.json: No such file or directory

I also have no node_modules in my home folder or any parent.

StephenFluin avatar May 17 '18 20:05 StephenFluin

Found a workaround on my machine: Manually deleted the package.json and yarn.lock from /Users/stephenfluin/.config/yarn/global

StephenFluin avatar May 17 '18 20:05 StephenFluin

I am facing same problem too in Mac .. please resolve It.

Sunnys-MacBook-Air:a4app sunnyshingala$ ng g components components/user Schematic "components" not found in collection "@schematics/angular". Error: Schematic "components" not found in collection "@schematics/angular". at SchematicEngine.createSchematic (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular-devkit/schematics/src/engine/engine.js:155:23) at CollectionImpl.createSchematic (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular-devkit/schematics/src/engine/collection.js:12:29) at Object.getSchematic (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular/cli/utilities/schematics.js:36:23) at GenerateCommand.getOptions (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular/cli/models/schematic-command.js:194:40) at GenerateCommand. (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular/cli/commands/generate.js:38:53) at Generator.next () at /Users/sunnyshingala/Desktop/a4app/node_modules/@angular/cli/commands/generate.js:7:71 at new Promise () at __awaiter (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular/cli/commands/generate.js:3:12) at GenerateCommand.initialize (/Users/sunnyshingala/Desktop/a4app/node_modules/@angular/cli/commands/generate.js:30:16)

sunnyshingala avatar May 19 '18 07:05 sunnyshingala

Deleting node_modules solved the problem.

ghost avatar May 19 '18 10:05 ghost

Deleting @angular/cli folder from global folder i.e., %username%/AppData/npm/node_modules/@angular/cli solved the problem @Brocco Can you please tell me how to check angular-config.json, .angular-cli.json, angular.json, .angular.json files in home directory as I cannot find these files anywhere in global folder.

npahalZenways avatar May 19 '18 16:05 npahalZenways

Yes thanks, I've resolved that problem . that was a problem in command.

Thanks, Sunny Shingala

On Sat, May 19, 2018 at 4:11 PM, astritspanca [email protected] wrote:

Deleting node_modules solved the problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/10862#issuecomment-390396415, or mute the thread https://github.com/notifications/unsubscribe-auth/AlZQJX1F6roChmhbgbS07G0MwRoBy0FFks5tz_brgaJpZM4T--Zu .

sunnyshingala avatar May 19 '18 18:05 sunnyshingala

Same problem.

Youssef-Ait-Elhaj avatar Jun 15 '18 11:06 Youssef-Ait-Elhaj

for macOS

cd ls rm-rf node_modules rm -f package_lock.json

peropranav avatar Jun 19 '18 05:06 peropranav

I'm having the same issue as mentioned above

$ ng new my-app Schematic "ng-new" not found in collection "@schematics/angular". Error: Schematic "ng-new" not found in collection "@schematics/angular". at SchematicEngine.createSchematic (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\engine\engine.js:155:23) at CollectionImpl.createSchematic (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\engine\collection.js:12:29) at Object.getSchematic (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\utilities\schematics.js:36:23) at NewCommand.getOptions (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\models\schematic-command.js:194:40) at NewCommand.initialize (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\commands\new.js:48:21) at Object. (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\models\command-runner.js:87:23) at Generator.next () at fulfilled (C:\Users\daled\AppData\Roaming\npm\node_modules@angular\cli\models\command-runner.js:4:58) at

Here are the versions of npm, node and angular. $ npm -v 5.6.0

$ node -v v8.11.3

$ ng -v

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/

Angular CLI: 6.0.8 Node: 8.11.3 OS: win32 ia32 Angular: ...

Package Version

@angular-devkit/architect 0.6.8 @angular-devkit/core 0.6.8 @angular-devkit/schematics 0.6.8 @schematics/angular 0.6.8 @schematics/update 0.6.8 rxjs 6.2.1 typescript 2.7.2

Solution

OS: Windows 10 Account: Administrator Angular Installation: Global (-g)

It seems that the problem is caused by file and folder permissions. When I created a new project folder at the base of my C: drive or even my D: drive signed in as myself (Administrator), the problem went away. Note: Just because you are the "Administrator" doesn't mean you have access to everything on Windows 10. The system account may create files and folders that you might not have full access to.

ddemott avatar Jul 03 '18 00:07 ddemott

Remove Node Modules folder from your root file.

DeepakM02 avatar Jul 07 '18 07:07 DeepakM02

Don't delete your global modules! Just : sudo npm i @schematics/angular or sudo npm uninstall @schematics/angular and sudo npm i @schematics/angular

ArthurBrito avatar Jul 12 '18 19:07 ArthurBrito

Removing Node Modules folder from root file resolved the issue.But I am not sure why do we need to do this? Can anybody help

koilBhupat avatar Aug 01 '18 10:08 koilBhupat

I Have the same problem: ng -v

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/

Angular CLI: 6.1.2 Node: 10.2.1 OS: linux x64 Angular: ...

Package Version

@angular-devkit/architect 0.7.2 @angular-devkit/core 0.7.2 @angular-devkit/schematics 0.7.2 @schematics/angular 0.7.2 @schematics/update 0.7.2 rxjs 6.2.2 typescript 2.7.2

when I trieyed to create à new project : ng g new test

Schematic "new" not found in collection "@schematics/angular". Error: Schematic "new" not found in collection "@schematics/angular". at SchematicEngine.createSchematic (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:224:23) at CollectionImpl.createSchematic (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:69:29) at Object.getSchematic (/usr/local/lib/node_modules/@angular/cli/utilities/schematics.js:43:23) at GenerateCommand.getOptions (/usr/local/lib/node_modules/@angular/cli/models/schematic-command.js:216:40) at GenerateCommand. (/usr/local/lib/node_modules/@angular/cli/commands/generate.js:45:53) at Generator.next () at fulfilled (/usr/local/lib/node_modules/@angular/cli/commands/generate.js:11:58) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:746:11) at startup (internal/bootstrap/node.js:238:19)

Any help ?

amelamel avatar Aug 07 '18 09:08 amelamel