2016-12-16 74 views
3

我是Angular 2 CLI的新手。按照教程,提供了一個叫做命令。 「ng創造」。我的方案是在現有目錄中創建項目。現有github項目的角度cli

它拋出如下錯誤 目錄'angular-basic'已經存在。

回答

1

嘗試ng init將在您的現有目錄內創建項目,然後執行ng serve

ng init <project-name> [options] 
Creates a new Angular project in the current folder. 

Options: 
--dry-run only output the files created and operations performed, do 
not actually create the project. 

Alias: 'd'. 
--verbose output more information. 

Alias: 'v'. 
--skip-npm do not run any npm command once the project is created. 
--name The name of the project to create. 

對於新的角度2.x的項目

ng new foo 
cd foo 
npm link angular-cli 
ng serve 

參見: https://cli.angular.io/reference.pdf

6

由於ng init命令從CLI命令刪除,你可以做的是指定目錄。您可能需要自己對一些現有文件進行一些覆蓋和修改。

您可以

ng new [app_name] --directory=directory_path_from_wherever_command_goes]

實例把它關閉,假設你的終端以角基本目錄打開,你必須CLI中添加到角基本的項目,ng new angular-basic --directory ./../angular-basic會做的更好。

UPDATE:

原因,它已被刪除是因爲有兩種方法可以創建一個項目的消息,也因爲人們用它來升級(很差) - 從CLI隊@Brocco的鳴叫。