Angular-cli: HELP ME Unknown collection "@schematics/angular" When I use ng g compent home

Created on 8 Sep 2017  ·  7Comments  ·  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/
@angular/cli: 1.4.0
node: 7.10.0
os: win32 x64
@angular/animations: 4.3.6
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/core: 4.3.6
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/platform-server: 4.3.6
@angular/router: 4.3.6
@angular/upgrade: 4.1.3
@angular/cli: 1.4.0
@angular/compiler-cli: 4.3.6
typescript: 2.3.4

Repro steps.

The log given by the failure.

ng g component r101c --module=eis/eis.module
Unknown collection "@schematics/angular".
Error: Unknown collection "@schematics/angular".
at SchematicEngine.createCollection (C:\PI-Data-Center-App\node_modules\@angular-devkit\schematics\src\engine\engine.js:45:19)
at Object.getCollection (C:\PI-Data-Center-App\node_modules\@angular\cli\utilities\schematics.js:32:31)
at Class.run (C:\PI-Data-Center-App\node_modules\@angular\cli\tasks\schematic-get-options.js:11:41)
at Class.beforeRun (C:\PI-Data-Center-App\node_modules\@angular\cli\commands\generate.js:89:31)
at Promise.resolve.then (C:\PI-Data-Center-App\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:150:24)

Most helpful comment

npm i @schematics/angular

All 7 comments

fix by
npm i '@.schematics/angular'

npm ERR! code ENOLOCAL
npm ERR! Could not install from ".schematics\angular'" as it does not contain a package.json file.

npm i @schematics/angular

Did try it without "." yesterday at the time of the post.
But it did not work, now it works, thanks 👍

@erika9star you are a life saver :+1 :)

Npm install works too

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