2016-12-16 60 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的鸣叫。

相关问题