2016-08-16 5 views
6

कोणीय CLI कोणीय 2 RC5 के साथ काम करने को स्थापित करने की कोशिश कर रहा है और मैं कुछ त्रुटियों का सामना करना पड़ रहा हूँ:आरसी 5 के लिए कोणीय-क्ली परियोजना को कॉन्फ़िगर कैसे करें?

नाम 'वादा'

मैं स्थापित किया है 'NPM जी स्थापित कोणीय CLI नहीं खोजा जा सका @webpack 'और ऐसा लगता है कि वह टाइपिंग इंस्टॉल नहीं करता है इसलिए वेबस्टॉर्म "वादा" नहीं जानता है।

क्या मुझे कोई सफलता के साथ tryied है

1.I स्थापित 'NPM स्थापित typings --save' लेकिन कोई बदलाव नहीं किया गया था।

webstorm परियोजना विन्यास मैं सक्षम 2.In: (सहायता नहीं मिलती,)

1. Use typescript service (Experimental) 
2. Enable typescript compiler 
2.1 Track changes 
2.2. Use tsconfig.json 

3.In tsconfig मैं es5 से लक्ष्य बदल ES6 के लिए और अब webstorm पहचान वादा/तो/कैच लेकिन टाइपप्रति फेंक त्रुटि है कि वह यह नहीं जानता है और अब मैं हर घटक में हर वर्ग पर नए त्रुटि का सामना: "experimentalDecorators": सच

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 में अजीब क्योंकि है। भले ही यह गलत है, कोई बदलाव नहीं है।

ngrx स्थापना errros और चेतावनी:

एक अन्य विषय में, स्थापित जब कोशिश कर रहा करने के लिए ngrx/कोर: 'NPM @ ngrx/कोर --save स्थापित'

installtion का अंत है:

.... 
.... 
`-- UNMET PEER DEPENDENCY [email protected]  <<-- In red color 

npm WARN optional Skipping failed optional dependency /chokidar/fsevents: 
npm WARN notsup Not compatible with your operating system or architecture: [email protected] 
.0.14 
npm WARN @angular/[email protected] requires a peer of [email protected]^1.9.0-dev but none 

मुझे इंस्टॉल करते समय वही चेतावनियां मिलती हैं: 'npm install @ ngrx/store --save'।

मैंने आयात सरणी में app.module.ts में जोड़ा: 'StoreModule.provideStore ({EmptyReducer})'। के बाद 'एनजी की सेवा' मैं कंसोल में निम्नलिखित चेतावनी मिलती है:

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 

अपने प्रोजेक्ट से कुछ कोड (यह खाली परियोजना):

app.module.ts:

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 { 

} 

tsconfig.json:

{ 
    "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 --save typings स्थापित')

{ 
    "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" 
    } 
} 

धन्यवाद बहुत।

+1

क्या आप ngrx मुद्दों को समझने में सक्षम थे? मैं वही सामना कर रहा हूँ। – user1354934

+0

कृपया इसका पालन करें: https://github.com/angular/angular-cli/issues/1723। जैसे ही मुझे जवाब मिल जाएगा, मैं यहां अपडेट करूँगा। –

उत्तर

1

आपको src/tsconfig.json पर जाना चाहिए और 'es5' से 'es6' तक लक्ष्य बदलना चाहिए।

उम्मीद है कि यह मदद करता है ..

संबंधित मुद्दे