简体   繁体   English

如何为服务器构建Angular 2.4.4项目

[英]How to Build Angular 2.4.4 project for server

My problem is that i need to build project but is the first time and i diden't find how to create bulid.json My pakage.json 我的问题是我需要构建项目,但这是第一次,但是我没有找到如何创建bulid.json的方法。

{
  "name": "test",
  "version": "1.0.0",
  "description": "some simple app",
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "lite": "lite-server",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/animations": "^4.4.3",
    "@angular/common": "2.4.4",
    "@angular/compiler": "2.4.4",
    "@angular/core": "2.4.4",
    "@angular/forms": "2.4.4",
    "@angular/http": "2.4.4",
    "@angular/platform-browser": "2.4.4",
    "@angular/platform-browser-dynamic": "2.4.4",
    "@angular/router": "3.4.4",
    "@angular/upgrade": "2.4.4",
    "angular2-bootstrap-switch": "^0.2.3",
    "angular2-in-memory-web-api": "0.0.21",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "css-toggle-switch": "^4.1.0",
    "mydatepicker": "^2.0.31",
    "mydaterangepicker": "^4.1.9",
    "ng2-bootstrap": "1.3.0",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.3",
    "systemjs": "0.20.0",
    "zone.js": "0.7.6",
    "tslint": "^5.7.0"
  },
  "devDependencies": {
    "concurrently": "3.1.0",
    "lite-server": "^2.2.0",
    "typescript": "2.0.3"
  },
  "repository": {}
}

I'm new in Angular 2 and if i correctly understand that to run site on Apache for simple web servers i need to build it i tried to run 我是Angular 2的新用户,如果我正确理解了要在Apache上为简单的Web服务器运行网站的情况,我需要对其进行构建,我尝试运行

ng build

but tells me that ng is not installed but if run 但是告诉我没有安装ng但是如果运行

npm start

site is opening and works correctly 网站正在打开并且可以正常工作

You'll need Angular CLI 您需要Angular CLI

npm install -g angular-cli

Once you have this, you can run ng build . 一旦有了这个,就可以运行ng build

Read the documentation, it provides a lot of useful information including targeting different build environments for prod/dev etc, running tests, creating new components/directives... 阅读文档,它提供了许多有用的信息,包括针对产品/开发等的不同构建环境,运行测试,创建新的组件/指令...

A useful guide to converting to a CLI app: 转换为CLI应用程序的有用指南:

https://github.com/asnowwolf/angular-cli/commit/515b57933688b37a389c84ee079d9b840a043666 https://github.com/asnowwolf/angular-cli/commit/515b57933688b37a389c84ee079d9b840a043666

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM