标签: angular-cli

错误:AppModule不是NgModule

我最近更新了2.4.1版本.

"@angular/common": "~2.4.1",
"@angular/compiler": "~2.4.1",
"@angular/compiler-cli": "^2.4.1",
"@angular/core": "~2.4.1",
"@angular/forms": "~2.4.1",
"@angular/http": "~2.4.1",
"@angular/platform-browser": "~2.4.1",
"@angular/platform-browser-dynamic": "~2.4.1",
"@angular/router": "~3.4.1",
"angular-cli": "^1.0.0-beta.24"
Run Code Online (Sandbox Code Playgroud)

当我使用2.0.0时,它不会出错,但现在,它会出现错误GET http://localhost:4200/null 404 (Not Found).

此外,当我尝试部署时,它会出现类似' AppModule is not an NgModule' 的错误.

即使它出错,它在本地运行良好.如果有人知道这件事,请告诉我.谢谢 :)

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { DeliveryComponent } …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

10
推荐指数
1
解决办法
1万
查看次数

如何在angular-cli中为长路径制作"别名"?

我正在使用Angular CLI.如何转换路径:

import {AppConfig, AppConfigInterface} from '../../../app.config';
Run Code Online (Sandbox Code Playgroud)

类似于:

import {AppConfig, AppConfigInterface} from 'root/app.config';
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

10
推荐指数
3
解决办法
9549
查看次数

模块构建失败:TypeError:无法读取未定义的属性"newLine"

在此输入图像描述

昨天一切都运行正常,现在当我尝试服务时,我得到了这些错误:

./src/main.ts中的错误模块构建失败:TypeError:无法读取Object.getNewLineCharacter上未定义的属性'newLine'(/Users/leongaban/Projects/TickerTags/wikitags/node_modules/typescript/lib/typescript.js:8062 :20)

我在这里和这里尝试了答案,但没有效果:(

我对angular-cli的全局和本地npm版本是1.0.0-beta.28.3如何将其升级到.30的?我试过了@latest


我的本地package.json:

"devDependencies": {
    "@angular/cli": "1.0.0-beta.28.3",
    "@angular/compiler-cli": "^2.4.0",
Run Code Online (Sandbox Code Playgroud)

我的全球套餐:

在此输入图像描述


我看到最新的是beta.32 https://github.com/angular/angular-cli/releases

但是,当我运行npm install -g angular-cli@latest它仍然安装.28.3

javascript angular-cli angular

10
推荐指数
1
解决办法
9853
查看次数

如何为Angular 2 CLI构建添加更少的内容?

我用Angular CLI创建了一个项目,我想在构建中添加更少的文件.我想要一个主要的少用于共享和全局样式,少一个文件用于本地样式的组件.如何在构建过程中添加无编译文件步骤?

less angular-cli angular

10
推荐指数
3
解决办法
1万
查看次数

Angular4 build - gzip缺失

当我ng build -prod --aot只运行.js文件时.

输出:

chunk    {0} polyfills.a2079361c5ff6d4e321e.bundle.js (polyfills) 285 kB {5} [initial] [rendered]
chunk    {1} main.d19edcafc399a0af8c0b.bundle.js (main) 2.33 MB {4} [initial] [rendered]
chunk    {2} scripts.22988bec4cd6ce344e9f.bundle.js (scripts) 973 kB {5} [initial] [rendered]
chunk    {3} styles.99705fb1bf9015185149.bundle.css (styles) 705 bytes {5} [initial] [rendered]
chunk    {4} vendor.377addf0a4997a085d42.bundle.js (vendor) 4.71 MB [initial] [rendered]
chunk    {5} inline.911ff25c95430bbf496e.bundle.js (inline) 0 bytes [entry] [rendered]
Run Code Online (Sandbox Code Playgroud)

我的问题是:

  1. .gz文件怎么了?
  2. 如何从express提供gzip文件?

angular-cli angular

10
推荐指数
1
解决办法
7040
查看次数

模块X的元数据版本不匹配中的错误发现版本4,预期3,解析符号Y.

我正在尝试使用angular-cli(ng build)构建一个Angular 4应用程序并使用ngx-clipboard.几天前我突然开始收到以下错误,即使我的应用程序源代码没有改变:

ERROR in Metadata version mismatch for module
ngx-clipboard/dist/index.d.ts, found version 4, expected 3, resolving
symbol AppModule in ...
Run Code Online (Sandbox Code Playgroud)

如果我恢复到过去工作的旧提交,它现在仍然以同样的方式失败.

我正在使用npm进行包管理.摘自我的package.json:

   "dependencies": {
     "@angular/animations": "4.0.0",
     "@angular/common": "4.0.0",
     "@angular/compiler": "4.0.0",
     "@angular/compiler-cli": "4.0.0",
     "@angular/core": "4.0.0",
     "@angular/forms": "4.0.0",
     "@angular/http": "4.0.0",
     "@angular/platform-browser": "4.0.0",
     "@angular/platform-browser-dynamic": "4.0.0",
     "@angular/platform-server": "4.0.0",
     "@angular/router": "4.0.0",
     "@types/highcharts": "^5.0.8",
     "angular2-busy": "^2.0.1",
     "bootstrap": "^3.3.6",
     "core-js": "^2.4.1",
     "element-resize-detector": "^1.1.11",
     "highcharts": "5.0.8",
     "jquery": "^1.11.3",
     "moment": "^2.10",
     "ng2-dragula": "^1.5.0",
     "ng2-tooltip": "0.0.7",
     "ngx-bootstrap": "^1.8.1",
     "ngx-clipboard": "^8.0.2",
     "ngx-clipboard": "~8.0.2",
     "ngx-popover": "0.0.16",
     "primeng": …
Run Code Online (Sandbox Code Playgroud)

npm angular-cli ngx-clipboard angular

10
推荐指数
1
解决办法
1万
查看次数

如何在Angular-CLI 6+中省略源映射

我想在ng build没有源映射的情况下构建.在以前的版本中,我可以使用--no-sourcemapor --sourcemap=false参数,但现在我得到:

Unknown option: '--sourcemap'

如何在Angular-CLI 6+中省略源映射?

angular-cli angular

10
推荐指数
2
解决办法
7739
查看次数

Angular:如何构建与ng服务创建的文件相同的文件

我正在优化我的Angular应用程序并使用webpack-bundle-analyzer来检查bundle的大小.当我运行ng build --stats-json它时会创建bundle.js文件并创建一个webpack-bundle-analyzer解析的json文件.这可以按预期工作,但是有一种方法可以构建角度应用程序,而无需优化构建执行,即获取相同文件ng serve生成的文件.我想要这个,因为我的应用程序非常大,在开发过程中重新加载它需要15秒.所以我希望能够检查这些文件.

javascript npm webpack angular-cli angular

10
推荐指数
1
解决办法
632
查看次数

由于CircularJSON,Angular CLI 7新项目失败

刚刚将Angular CLI重新安装到版本7.1.1.运行时ng new project-name,会发生以下错误:

npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! code ERR_STREAM_WRITE_AFTER_END npm ERR! write after end
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\[username]\AppData\Roaming\npm-cache\_logs\2018-12-04T20_40_23_399Z-debug.log
Package install failed, see above.

更改为项目目录时,无法提供新的Angular应用程序.怎么修这个呢?

npm angular-cli angular

10
推荐指数
1
解决办法
7031
查看次数

在Angular中做什么“您想使用哪种样式表格式(使用箭头键)”

我正在使用angular cli创建一个Angular项目,他们问我“您想使用哪种样式表格式(使用箭头键)”以及其他格式。

为什么会出现?

angular-cli angular

10
推荐指数
1
解决办法
9010
查看次数

标签 统计

angular ×10

angular-cli ×10

npm ×3

javascript ×2

less ×1

ngx-clipboard ×1

webpack ×1