如何在Angular CLI上迁移Angular-2应用 [英] How to migrate Angular-2 app on Angular CLI

查看:80
本文介绍了如何在Angular CLI上迁移Angular-2应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用Sing App-Web& Angular 2.0仪表板模板可用于我们的工作,但此应用程序不是基于Angular CLI项目的.我必须将此应用程序放在Angular CLI上.我尝试了一些选项,但未成功.请建议最好的方法将此应用程序带入Angular CLI.

I am going to use Sing App - Web & Angular 2.0 Dashboard template for our assignment but this app is not based on Angular CLI project. I have to bring this app on Angular CLI.I have tried some option but not succeeds. Please suggest the best way bring this app over Angular CLI.

推荐答案

更新08/07/2017: 如果您正在寻找如何升级cli的方法迁移到较新版本时发生重大更改,请检查此答案

  1. 先运行npm uninstall -g angular-cli,然后再运行npm cache clean
  2. 运行npm install -g angular-cli更多详细信息此处
  3. 备份您的app
  4. 转到您的app文件夹
  5. 运行ng init-此命令将通过向现有应用程序写入一些文件来初始化angular-cli应用程序.覆盖现有文件时要小心,跳过不确定的文件,但是始终可以参考备份.
  6. 运行ng new simple-app-您将以此为真理应用程序的angular-cli源.
  7. app中的angular-cli生成/需要的文件与simple-app进行比较,以查看在步骤 4期间是否丢失了任何内容.
  8. 确保所有返回的angular-cli npm模块都已安装到您的app中(比较package.json文件)
  9. 运行npm start,它可能会给您一个必须修复的错误.您可能需要在此处返回步骤 7. 8..如果您弄乱了软件包,则可能需要删除node_modules文件夹并运行npm install.
  10. 您可以通过 http://localhost:4200
  11. 访问您的app
  1. Run npm uninstall -g angular-cli thennpm cache clean
  2. Run npm install -g angular-cli more details here
  3. Backup your app
  4. Go to your app folder
  5. Run ng init - this command will initialize the angular-cli app by writing some files in to your existing app. Be careful with overriding the existing files, skip the ones you are not sure, however you always can refer to your backup.
  6. Run ng new simple-app - this one you will be using as a angular-cli source of truth app.
  7. Compare files produced/required by angular-cli in your app with simple-app to see if anything gets missed during step 4.
  8. Make sure that all requited angular-cli npm modules gets installed in to your app (compare package.json files)
  9. Run npm start it might give you an errors you have to fix. You might need to go back to steps 7. and 8. here. If you mess up the packages you might need to remove node_modules folder and run npm install.
  10. You can access your app at http://localhost:4200

这篇关于如何在Angular CLI上迁移Angular-2应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆