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

'ng new' fails

Open theChrisMarsh opened this issue 9 years ago • 34 comments

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.

theChrisMarsh avatar Oct 10 '17 00:10 theChrisMarsh

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

reasonablytall avatar Oct 10 '17 00:10 reasonablytall

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

awsaunier avatar Oct 10 '17 00:10 awsaunier

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

zinzinday avatar Oct 10 '17 00:10 zinzinday

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)

cfcortes avatar Oct 10 '17 00:10 cfcortes

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)

GaboSantyCosta avatar Oct 10 '17 00:10 GaboSantyCosta

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>

jameskbride avatar Oct 10 '17 00:10 jameskbride

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)

puppycock avatar Oct 10 '17 00:10 puppycock

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

leotheloser avatar Oct 10 '17 00:10 leotheloser

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.

noeazar avatar Oct 10 '17 01:10 noeazar

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>

icarnaghan avatar Oct 10 '17 01:10 icarnaghan

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

Casebash avatar Oct 10 '17 01:10 Casebash

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\npm\node_modules@angular\cli\ember-cli\lib\models\command.js:377:13) at Array.map (native) at Class.registerOptions (C:\Users\shmoorth\AppData\Roaming\npm\node_modules@angular\cli\ember-cli\lib\models\command.js:163:27) at getOptionsTask.run.then (C:\Users\shmoorth\AppData\Roaming\npm\node_modules@angular\cli\commands\new.js:95:18)

Shravanthy avatar Oct 10 '17 01:10 Shravanthy

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

skitto0307 avatar Oct 10 '17 01:10 skitto0307

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.

delasteve avatar Oct 10 '17 01:10 delasteve

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

joewimmer avatar Oct 10 '17 01:10 joewimmer

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

jameskbride avatar Oct 10 '17 01:10 jameskbride

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

GaboSantyCosta avatar Oct 10 '17 01:10 GaboSantyCosta

@delasteve all working now! Cheers ::))

leotheloser avatar Oct 10 '17 01:10 leotheloser

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

hansl avatar Oct 10 '17 01:10 hansl

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

Shravanthy avatar Oct 10 '17 01:10 Shravanthy