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

Created on 15 May 2018  Â·  25Comments  Â·  Source: angular/angular-cli

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\Roamingnpm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\srcengineengine.js:155:23)
at CollectionImpl.createSchematic (C:\Users\pahal\AppData\Roamingnpm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\srcengine\collection.js:12:29)
at NodeWorkflow.execute (C:\Users\pahal\AppData\Roamingnpm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\workflow\node-workflow.js:69:38)
at Promise (C:\Users\pahal\AppData\Roamingnpm\node_modules\@angular\cli\models\schematic-command.js:140:22)
at new Promise ()
at NewCommand.runSchematic (C:\Users\pahal\AppData\Roamingnpm\node_modules\@angular\cli\models\schematic-command.js:139:16)
at NewCommand. (C:\Users\pahal\AppData\Roamingnpm\node_modules\@angular\cli\commands\new.js:77:25)
at Generator.next ()
at C:\Users\pahal\AppData\Roamingnpm\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)

angulacli more info

Most helpful comment

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.

😸

All 25 comments

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

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.

😸

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

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.

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

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!

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

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

```Angular CLI: 6.0.3
Node: 9.11.1
OS: darwin x64
Angular:
...

Package Version

@angular-devkit/architect
@angular-devkit/core
@angular-devkit/schematics
@schematics/angular 0.6.3
@schematics/update
rxjs
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.

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

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)

Deleting node_modules solved the problem.

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.

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 notifications@github.com
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
.

Same problem.

for macOS

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

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\Roamingnpmnode_modules\@angular\clinode_modules\@angular-devkit\schematics\srcengineengine.js:155:23)
at CollectionImpl.createSchematic (C:\Users\daled\AppData\Roamingnpmnode_modules\@angular\clinode_modules\@angular-devkit\schematics\srcengine\collection.js:12:29)
at Object.getSchematic (C:\Users\daled\AppData\Roamingnpmnode_modules\@angular\cli\utilities\schematics.js:36:23)
at NewCommand.getOptions (C:\Users\daled\AppData\Roamingnpmnode_modules\@angular\cli\models\schematic-command.js:194:40)
at NewCommand.initialize (C:\Users\daled\AppData\Roamingnpmnode_modules\@angular\cli\commands\new.js:48:21)
at Object. (C:\Users\daled\AppData\Roamingnpmnode_modules\@angular\cli\models\command-runner.js:87:23)
at Generator.next ()
at fulfilled (C:\Users\daled\AppData\Roamingnpmnode_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.

Remove Node Modules folder from your root file.

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

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

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 ?

I Have the same problem,
@ArthurBrito 's answer solved the issue -

  1. npm uninstall @schematics/angular
  2. npm i @schematics/angular

Thanks OfirTheOne, this solution worked for me.

npm i @schematics/angular

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MateenKadwaikar picture MateenKadwaikar  Â·  3Comments

rajjejosefsson picture rajjejosefsson  Â·  3Comments

IngvarKofoed picture IngvarKofoed  Â·  3Comments

JanStureNielsen picture JanStureNielsen  Â·  3Comments

ericel picture ericel  Â·  3Comments