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

ng new not working @6.0.0

Open djidel opened this issue 8 years ago • 20 comments

Versions

NPM 5.6.0 Angular CLI: 6.0.0 Node: 10.0.0 OS: win32 x64 Angular: ... Package Version angular-devkit/architect 0.6.0 angular-devkit/core 0.6.0 angular-devkit/schematics 0.6.0 schematics/angular 0.6.0 schematics/update 0.6.0 rxjs 6.1.0 typescript 2.7.2

Repro steps

ng new ng-app

Observed behavior

Commande output:

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

Desired behavior

Should generate angular app

djidel avatar May 07 '18 10:05 djidel

Your install must be broken. It works fine for me.

larssn avatar May 07 '18 14:05 larssn

@larssn do you have the same npm and node versions?

djidel avatar May 07 '18 14:05 djidel

same problem for me

dev2colours avatar May 07 '18 14:05 dev2colours

I have exactly the same versions yes.

larssn avatar May 07 '18 14:05 larssn

I reinstalled node v10.0.0 but I have the same error still. now installed node v8.11.1 and still I have the same problem.

djidel avatar May 07 '18 14:05 djidel

@larssn are you on Windows x64?

djidel avatar May 07 '18 14:05 djidel

npm install -g npm npm uninstall -g angular-cli npm cache clean npm install -g @angular/cli@lates

tonmanayo avatar May 08 '18 07:05 tonmanayo

@tonmanayo I tried your instructions, that doesn't solve the problem for me.

djidel avatar May 08 '18 08:05 djidel

I tested in another machine with the same environment and it works! But I don't know why it still doesn't work in the first machine. I tried uninstalling npm, deleting the npm and npm-cache folders from \AppData\Roaming\, and installing again with no success.

Any thoughts on what could cause the problem?

djidel avatar May 08 '18 15:05 djidel

Could you provide the output of both the following commands?

npm ls -g @schematics/angular
npm ls @schematics/angular

clydin avatar May 08 '18 15:05 clydin

@clydin This is the output:

> npm ls -g @schematics/angular
C:\Users\User\AppData\Roaming\npm
`-- @angular/[email protected]
  `-- @schematics/[email protected]

> npm ls @schematics/angular
C:\Users\User
+-- @angular/[email protected]
| `-- @schematics/[email protected]  extraneous
`-- @schematics/[email protected]

npm ERR! extraneous: @schematics/[email protected] C:\Users\User\node_modules\@angular\cli\node_modules\@schematics\angular

djidel avatar May 08 '18 15:05 djidel

From the output from the second command it appears that there is a node_modules folder (and potentially package.json) with both the CLI and an old version of @schematics/angular installed locally (C:\Users\User). This is most likely the source of the problem and under typical scenarios should not be present.

clydin avatar May 08 '18 15:05 clydin

@clydin You are right, there is a node_modules folder in C:\Users\User\, and removing the folder solved the problem. Thank you, and sorry for the trouble.

djidel avatar May 08 '18 15:05 djidel

No problem. I'm glad you got it sorted out.

clydin avatar May 08 '18 15:05 clydin

Awesome man its working fine. Spend hell lot of time to identify the issue but this is really nice.

Thank you so much @clydin

rahulshukla422 avatar May 25 '18 19:05 rahulshukla422

Hi!

I have the same problem. I don´t understand which folder exactly is to delete?!?! Simply deleting the whole node_module folder under /user/my_username/ doesn´t solve the problem. I can generate a new app but this consists only of the @angular/cli and all other packages are missing.

FelixKre avatar Jul 11 '18 12:07 FelixKre

npm install -g npm npm uninstall -g @angular/cli npm uninstall @angular/cli npm cache clean --force npm install -g @angular/cli@latest

check if it's work otherwise just update two more packages

npm i -g @schematics/angular npm i -g @schematics/angular

npm i @schematics/angular npm i @schematics/angular

This will force to update both local and global package.json file to use all the dependencies of angular 6

Hope this will work, This approach had worked in my mac

raviranjan0631 avatar Jul 25 '18 09:07 raviranjan0631

npm install g @angular/cli the command global installation create the problem in acessing the c drive so installing tha angular cli in the project folder will not cause ant warning or error screenshot_1

vickytechkey avatar Oct 14 '18 10:10 vickytechkey

same problem for me npm install g @angular/cli the command global installation create the problem in acessing the c drive so installing tha angular cli in the project folder will not cause ant warning or error screenshot_1

vickytechkey avatar Oct 14 '18 10:10 vickytechkey

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.