试图安装angular-CLI来与angular 2 rc5一起工作,我面临一些错误:
2.在webstorm项目配置中,我启用了:(没有帮助)
1. Use typescript service (Experimental)
2. Enable typescript compiler
2.1 Track changes
2.2. Use tsconfig.json
3.在tsconfig中,我将target从es5改为es6,现在webstorm识别promise/then/catch,但typescript抛出了他不知道的错误,现在我在每个组件的每个类上都面临新的错误:
export class AppComponent <-- ERROR
{
}
export class AppModule <-- ERROR
{
}
Error:(8, 14) TS1219:Experimental support for decorators is
a feature that is subject to change in a future release.
Set the 'experimentalDecorators' option to remove this warning.
这很奇怪,因为在tsconfig.json中:“experimentaldecorators”:true。即使是假的,也没有变化。
在另一个主题中,当试图安装ngrx/core时:“npm install@ngrx/core--保存”
安装的结尾是:
....
....
`-- UNMET PEER DEPENDENCY typescript@2.0.0 <<-- In red color
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1
.0.14
npm WARN @angular/tsc-wrapped@0.2.2 requires a peer of typescript@^1.9.0-dev but none
我在安装时得到相同的警告:'npm install@ngrx/store--save'。
WARNING in ./~/@ngrx/store/index.js
Cannot find source file '../src/index.ts': Error: Can't resolve '../src/index.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./src/app/app.module.ts 15:0-42
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
WARNING in ./~/@ngrx/store/dispatcher.js
Cannot find source file '../src/dispatcher.ts': Error: Can't resolve '../src/dispatcher.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./~/@ngrx/store/index.js 5:9-32
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
WARNING in ./~/@ngrx/store/ng2.js
Cannot find source file '../src/ng2.ts': Error: Can't resolve '../src/ng2.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./~/@ngrx/store/index.js 6:9-25
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
WARNING in ./~/@ngrx/store/reducer.js
Cannot find source file '../src/reducer.ts': Error: Can't resolve '../src/reducer.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./~/@ngrx/store/index.js 7:9-29
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
WARNING in ./~/@ngrx/store/state.js
Cannot find source file '../src/state.ts': Error: Can't resolve '../src/state.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./~/@ngrx/store/index.js 8:9-27
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
WARNING in ./~/@ngrx/store/store.js
Cannot find source file '../src/store.ts': Error: Can't resolve '../src/store.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./~/@ngrx/store/index.js 9:9-27
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
WARNING in ./~/@ngrx/store/utils.js
Cannot find source file '../src/utils.ts': Error: Can't resolve '../src/utils.ts' in 'C:\Users\armyTik\Desktop\rc5\store-app-02\node_modules\@ngrx\store'
@ ./~/@ngrx/store/index.js 10:9-27
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ApplicationRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import {StoreModule} from "@ngrx/store";
import { ActionReducer, Action } from '@ngrx/store';
export const EmptyReducer: ActionReducer<number> = (state: number = 0, action: Action) => {
switch (action.type) {
default:
return state;
}
}
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
CommonModule,
FormsModule,
StoreModule.provideStore({EmptyReducer})
],
providers: [],
entryComponents: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {
}
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es6", <<-- I changed from es5 to es6
"typeRoots": [
"../node_modules/@types"
],
"types": [
"jasmine"
]
}
}
package.json:(我手动安装了“NPM安装类型--保存”)
{
"name": "store-app-02",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-rc.1",
"@ngrx/core": "^1.0.2",
"@ngrx/store": "^2.1.2",
"core-js": "^2.4.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"ts-helpers": "^1.1.1",
"typings": "^1.3.2",
"zone.js": "0.6.12"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"@types/protractor": "^1.5.16",
"angular-cli": "1.0.0-beta.11-webpack.2",
"codelyzer": "0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"karma-remap-istanbul": "^0.2.1",
"protractor": "3.3.0",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "^2.0.0"
}
}
非常感谢你的阅读。
您应该转到src/tsconfig.json
并将目标从'es5'更改为'es6'。
希望能有所帮助..
我正在尝试从
我刚刚将我的项目从angular-cli beta.10升级到angular-cli@WebPack(beta.18),现在我的specs.ts都没有解析(找不到名称'description'等)。有关于如何为我的项目配置单元测试的信息吗?
尝试为Angular 7代码库设置Sonarqube以进行代码覆盖率分析。我已经安装了Sonarqube并在Admin中创建了一个项目,获得了授权cmd “sonar-scanner.bat-d”sonar.projectkey=testapp“-d”sonar.sources=.“-d”sonar.host.url=http://127.0.0.1:9000“-d”sonar.login=508
问题内容: 我是Docker的一名新手,目前正尝试使用Angular项目创建ASP.NET Core 2.1。我正在Windows的Docker上使用Linux容器,而我的IDE是VS2017社区版。 目前,我收到此错误: [1]确保已安装“ npm”,并且可以在PATH目录之一中找到它。当前的PATH环境变量为:/ usr / local / sbin:/ usr / local / bin:/
问题内容: 我正在尝试为Windows安装angular-cli。我知道该命令是npm install -g angular- cli,但是一旦运行此命令,我便尝试执行ng new,但是我收到一条错误消息,说“ ng不能识别的命令”,我在这里检查了其他问题,说您必须将文件夹添加到PATH变量中,但是当我检入文件夹时,我尝试将angular- cli安装到该文件夹中甚至都看不到。 在这里您可以看
我有一个项目不是使用创建的(相反,我遵循了快速入门指南)。当我在项目中运行angular CLI命令(如)时,我会得到以下错误消息: 有什么方法可以把我现有的项目变成angular-cli项目吗?(我想尝试使用它,因为它显然自动解决了桶导入和SystemJS的问题。)