Angular-cli: 'ng new' fails

Created on 10 Oct 2017  ยท  34Comments  ยท  Source: angular/angular-cli

Bug Report

Versions

@angular/cli โ€” 1.4.5
node โ€” 7.2.1
npm โ€” 5.4.2
os โ€” win32 x64 (Windows 10)

Repro Steps

ng new sample-app

The log given by the failure

C:\Development>ng new sample-app
The command "new" has an option without the required type and name fields.
Error: The command "new" has an option without the required type and name fields.
    at Class.validateOption (C:\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:377:13)
    at Array.map (native)
    at Class.registerOptions (C:\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:163:27)
    at getOptionsTask.run.then (C:\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\commands\new.js:95:18)

Other details that might be useful

I have used npm to uninstall @angular/cli and reinstall it globally.
Other commands also fail with the same error. For example ng g component some-new-component also throws the error:

The command "generate" has an option without the required type and name fields.

Most helpful comment

Just spoke with @hansl - he reverted the last commit to https://github.com/angular/devkit. I just tested after reinstalling the CLI and everything is back to working.

All 34 comments

Getting this too. On a fresh install of node/npm.

@angular/cli โ€” 1.4.5
node โ€” 6.11.4
npm โ€” 3.10.10
os โ€” Windows 10 x64

I have the same problem after uninstalling and reinstalling to the latest version using npm.

stdout@desktop-94847:/data/nodejs/angular4$ ng generate component my-new-component
The command "generate" has an option without the required type and name fields.
Error: The command "generate" has an option without the required type and name fields.
    at Class.validateOption (/data/nodejs/angular4/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13)
    at Array.map (<anonymous>)
    at Class.registerOptions (/data/nodejs/angular4/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27)
    at getOptionsTask.run.then (/data/nodejs/angular4/node_modules/@angular/cli/commands/generate.js:98:18)
    at <anonymous>

I have the same problem

I am having the same problem

The command "new" has an option without the required type and name fields.
Error: The command "new" has an option without the required type and name fields.
at Class.validateOption (/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13)
at Array.map (native)
at Class.registerOptions (/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27)
at getOptionsTask.run.then (/node_modules/@angular/cli/commands/new.js:95:18)

I have the same problem

@angular/cli: 1.4.5
node: 6.11.4
os: win32 x64
npm: 5.4.2

The command "new" has an option without the required type and name fields.
The command "generate" has an option without the required type and name fields.
Error: The command "new" has an option without the required type and name fields.
at Class.validateOption (/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13)
at Array.map (native)
at Class.registerOptions (/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27)
at getOptionsTask.run.then (/node_modules/@angular/cli/commands/new.js:95:18)

Same here with new:

@angular/cli โ€” 1.4.5
node โ€” 8.6.0
npm โ€” 5.3.0
os โ€” MacOS Sierra (10.12.6)
20:44 $ ng new static
The command "new" has an option without the required type and name fields.
Error: The command "new" has an option without the required type and name fields.
    at Class.validateOption (/Users/jameskbride/.config/yarn/global/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13)
    at Array.map (<anonymous>)
    at Class.registerOptions (/Users/jameskbride/.config/yarn/global/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27)
    at getOptionsTask.run.then (/Users/jameskbride/.config/yarn/global/node_modules/@angular/cli/commands/new.js:95:18)
    at <anonymous>

Getting the same error on a fresh installation.

@angular/cli: 1.4.5 node: 6.11.3 os: win32 x64

C:\Dropbox\Nodejs>ng new Angular The command "new" has an option without the required type and name fields. Error: The command "new" has an option without the required type and name fields. at Class.validateOption (C:\Users\TRABAJO\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:377:13) at Array.map (native) at Class.registerOptions (C:\Users\TRABAJO\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:163:27) at getOptionsTask.run.then (C:\Users\TRABAJO\AppData\Roaming\npm\node_modules\@angular\cli\commands\new.js:95:18)

I am also experiencing the issue. Freshly installed CLI.

The command "new" has an option without the required type and name fields.
Error: The command "new" has an option without the required type and name fields.
    at Class.validateOption (/usr/local/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13)
    at Array.map (<anonymous>)
    at Class.registerOptions (/usr/local/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27)
    at getOptionsTask.run.then (/usr/local/lib/node_modules/@angular/cli/commands/new.js:95:18)
    at <anonymous>

Edit: This applied to

ng generate

as well

Installed the CLI and then got this error when trying to generate a new component:

The command "generate" has an option without the required type and name fields.
Error: The command "generate" has an option without the required type and name fields.

I have the same issue. I installed Angular for the first time this evening on this Macbook Pro:

@angular/cli - 1.4.5
node - 8.6.0
npm - 5.3.0
OS - MacOS Sierra 10.12.6

The command "new" has an option without the required type and name fields. Error: The command "new" has an option without the required type and name fields. at Class.validateOption (/usr/local/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13) at Array.map (<anonymous>) at Class.registerOptions (/usr/local/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27) at getOptionsTask.run.then (/usr/local/lib/node_modules/@angular/cli/commands/new.js:95:18) at <anonymous>

I have the same problem

@angular/cli - 8.6.0
node - 1.4.5
npm - 5.3.0
OS - MacOS High Sierra 10.13

Error: The command "new" has an option without the required type and name fields.
at Class.validateOption (/Users/chris/.nvm/versions/node/v8.6.0/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:377:13)
at Array.map ()
at Class.registerOptions (/Users/chris/.nvm/versions/node/v8.6.0/lib/node_modules/@angular/cli/ember-cli/lib/models/command.js:163:27)
at getOptionsTask.run.then (/Users/chris/.nvm/versions/node/v8.6.0/lib/node_modules/@angular/cli/commands/new.js:95:18)
at

I have the same problem as well

node - v6.11.4
npm - 3.10.10
@angular/cli - 1.4.5
os - win32 x64

ng new testdemo

The command "new" has an option without the required type and name fields.
Error: The command "new" has an option without the required type and name fields.
at Class.validateOption (C:Users\shmoorth\AppData\Roaming\npmnode_modules\@angular\cli\ember-cli\lib\models\command.js:377:13)
at Array.map (native)
at Class.registerOptions (C:Users\shmoorth\AppData\Roaming\npmnode_modules\@angular\cli\ember-cli\lib\models\command.js:163:27)
at getOptionsTask.run.then (C:Users\shmoorth\AppData\Roaming\npmnode_modules\@angular\cli\commands\new.js:95:18)

Same
I have the same problem. I had to install 1.3.2 to be able to use the command "ng new [appname]" again.

@angular/cli: 1.4.5
node: 6.11.4
os: win32 x64
npm: 5.4.2

Just spoke with @hansl - he reverted the last commit to https://github.com/angular/devkit. I just tested after reinstalling the CLI and everything is back to working.

Yup. worked for me now. Thanks @delasteve and @hansl

@delasteve Uninstalled @angular/cli and reinstalled (on the assumption that devkit has been updated). Back in business now. Thanks!

the problem was solved!

now run

npm uninstall -g @angular/cli
npm cache clean
if npm version is > 5 then use npm cache verify to avoid errors (or to avoid using --force)
npm install -g @angular/cli@latest

@delasteve all working now! Cheers ::))

Fixed by reverting the faulty PR. We'll need to be more careful when untangling the Schematics from the CLI. Closing this as fixed.

Working fine for me now. Thank you @delasteve and @hansl

Working for me now too!

Working! Thank You

Is depending on ~0.0.x for devkit (https://github.com/angular/angular-cli/blob/master/package.json#L45) the right move?

Since this means any changes to devkit get rolled out to existing cli versions arbitrarily on the next npm install, I expect this kind of breakage will happen relatively often.

If the cli is depending on 'latest' from upstream packages, having any kind of cli release tags becomes somewhat meaningless.

Working now, thanks.

I still have the same error

i can create project via ng new project-name but can not to generate component but remove folder node_modules and run npm install after working fine with ng

I still not able to get. Same error is coming.

I have a possible solution.

Either upgrade from Node 6 to Node 8 or, downgrade to Angular 1.4.2.

This error happens under:
Node 6 with Angular 1.4.3
Node 6 with Angular 1.4.4
Node 6 with Angular 1.4.5

However Node 8 with Angular 1.4.5, works.
Node 6 with Angular 1.4.2 works.

Working fine now. Thanks.

I updated to node 8 and it is now working for me.

I'm still getting this error even with Node 8 and by installing 1.4.2 manually from NPM.

Windows 10

Still getting this error as well. Node 8, Angular CLI version 1.4.5.

I have cleared the NPM cache, as well as re installed the CLI globally, and still no luck.

Is there anything outside of the cache and the global installation that could possibly be referencing a bad install of the Angular CLI on my local environment?

me too getting the same error. completely removed the node and verified the package.

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

rwillmer picture rwillmer  ยท  3Comments

delasteve picture delasteve  ยท  3Comments

purushottamjha picture purushottamjha  ยท  3Comments

MateenKadwaikar picture MateenKadwaikar  ยท  3Comments

brtnshrdr picture brtnshrdr  ยท  3Comments