欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

angular 7.0.5 ng new doesn't ask Would you like to add Angular routing?… etc angular 7.0.5 ng new不会询问您是否要添加Angular路由?…等等 有大用 有大大用 有大大大用

还有 # ng add ng-zorro-antd 也是同样的情况  不会 询问 ( ask ) 让你选择 ( choose select )             
5                    

有人可以指导我了解为什么我无法使用新版本的angular 7生成新项目                    

所需结果:                    

在此处输入图片说明                    

ng new firebase-auth?您想添加角度路由吗?不是吗 您想使用哪种样式表格式?的CSS                    

获得的结果:                    

 $ ng new appAtlas
    CREATE appAtlas/angular.json (3786 bytes)
    CREATE appAtlas/package.json (1316 bytes)
    CREATE appAtlas/README.md (1025 bytes)
    CREATE appAtlas/tsconfig.json (408 bytes)
    CREATE appAtlas/tslint.json (2837 bytes)
    CREATE appAtlas/.editorconfig (245 bytes)
    CREATE appAtlas/.gitignore (503 bytes)
    CREATE appAtlas/src/favicon.ico (5430 bytes)
    ....
    CREATE appAtlas/e2e/src/app.po.ts (208 bytes)
    npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, fl                                   atted is its successor.
                   

Angular CLI版本                    

$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 7.0.5
Node: 10.13.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.10.5
@angular-devkit/core         7.0.5
@angular-devkit/schematics   7.0.5
@schematics/angular          7.0.5
@schematics/update           0.10.5
rxjs                         6.3.3
typescript                   3.1.6
                   

节点,npm版本                    

$ node -v
v10.13.0

$ npm --version
6.4.1
               
改善这个问题                            
       

2个答案   正确答案                 

活跃的最古老的选票                    
       
1个                        

您是否尝试过另一个终端?                        

我注意到当我使用 Windows命令提示符(CMD) ( dos  ) ( git cmd ) ( powershell )时会收到交互式提示,但在Cygwin中 ( git bash )却没有即使使用ng new new_project --interactive=true,Cygwin 也会跳过提示,并使用类似于屏幕截图的默认选项。                        

改善这个答案                            
       
0                        

我有同样的问题。但是,当您想通过命令行创建新的角度项目时,我找到了解决遗漏问题的解决方案。                        

因此,请尝试以下步骤:                        

  1. 看下面的文件,安装了什么样的angular-cli版本=> C:\Users\[yourNickname]\AppData\Roaming\npm\node_modules\@angular\cli\package.json

  2. 删除目录 @angular

  3. 转到命令行并输入 npm cache verify

  4. 然后输入 npm install -g @angular/cli

  5. 转到要创建角度项目的文件夹,然后键入 ng new MyApp

好了,问题必须再次显示给您:)                        

改善这个答案                            
  • 您可以ng version查看已安装的cli版本...也可以在npm r -g @angular/cli全球范围内删除它... –  Baruch 1月25日,18:33                                     
  • 是的,我的问题是,我有2个不同的angular cli版本。最新的第一个7.2.3位于路径中C:\Users\UserName\...,而旧版本的1.0.0.beta位于路径中C:\Users\UserName.DOMAIN\...。.当我创建一个角度项目时,它总是从旧帐户中获取旧版本。我不知道为什么 我做了回答中的步骤,现在可以使用了。 –  yuro 1月25日18:42                                    
       

来自  https://stackoverflow.com/questions/53244056/angular-7-0-5-ng-new-doesnt-ask-would-you-like-to-add-angular-routing-etc            


           


           



Asked 
Active 3 months ago
Viewed 5k times
5

Someone could guide me to know why I can not generate a new project with the new version of angular 7

Desired result:

enter image description here

ng new firebase-auth ? Would you like to add Angular routing? No ? Which stylesheet format would you like to use? CSS

obtained result:

 $ ng new appAtlas
    CREATE appAtlas/angular.json (3786 bytes)
    CREATE appAtlas/package.json (1316 bytes)
    CREATE appAtlas/README.md (1025 bytes)
    CREATE appAtlas/tsconfig.json (408 bytes)
    CREATE appAtlas/tslint.json (2837 bytes)
    CREATE appAtlas/.editorconfig (245 bytes)
    CREATE appAtlas/.gitignore (503 bytes)
    CREATE appAtlas/src/favicon.ico (5430 bytes)
    ....
    CREATE appAtlas/e2e/src/app.po.ts (208 bytes)
    npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, fl                                   atted is its successor.

Angular cli version

$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 7.0.5
Node: 10.13.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.10.5
@angular-devkit/core         7.0.5
@angular-devkit/schematics   7.0.5
@schematics/angular          7.0.5
@schematics/update           0.10.5
rxjs                         6.3.3
typescript                   3.1.6

Node, npm version

$ node -v
v10.13.0

$ npm --version
6.4.1

2 Answers  

正确答案  

1

Have you tried another terminal?

I noticed I get the interactive prompts when I use Windows Command Prompt (CMD) (dos )  ( git cmd ) ( powershell )    ,   but I don't get them in Cygwin ( git bash ). Even if I use ng new new_project --interactive=true, Cygwin just skips the prompts and goes with the default options similar to your screenshot.

0

I had the same problem. But I found a solution for the missing questions when you wanna create a new angular project via the command line.

So, try the following steps:

  1. Look in the following file, what kind of angular-cli version is installed => C:\Users\[yourNickname]\AppData\Roaming\npm\node_modules\@angular\cli\package.json

  2. Delete the directory @angular

  3. Go to the command line and type npm cache verify

  4. Then type npm install -g @angular/cli

  5. Change to your folder where you wanna create the angular project and type ng new MyApp

Well, the questions have to display you again :)

  • You can do ng version to see what version of the cli you have installed...Also, you can do npm r -g @angular/cli to remove it globally... – Baruch Jan 25 at 18:33 
  • Yeah my problem was, I had 2 different angular cli versions. The first newest one 7.2.3 was in the path C:\Users\UserName\... and the old one with the version 1.0.0.beta was in the path C:\Users\UserName.DOMAIN\..... When I created an angular project it always took the old version from the old account. I don't know why. I did the steps in my answer and it works now. – yuro Jan 25 at 18:42

来自  https://stackoverflow.com/questions/53244056/angular-7-0-5-ng-new-doesnt-ask-would-you-like-to-add-angular-routing-etc



普通分类: