1
我似乎有一個非常類似的問題,如here和here,使用Angular CLI 1.0.0-beta.24和Angular 2.4.1。'AppModule不是NgModule'錯誤,儘管將Typescript設置爲版本2.0.10
但是,將我的Typescript版本設置爲2.0.10並沒有幫助,但在運行ng build
時仍然獲得'AppModule不是NgModule'。
這是我的package.json,我在哪裏使用錯誤的依賴或版本?
{
"name": "my-project",
"version": "0.1.0",
"license": "",
"angular-cli": {},
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"karma": "karma start karma.conf.js"
},
"private": true,
"dependencies": {
"@angular/common": "2.4.1",
"@angular/compiler": "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/upgrade": "2.4.1",
"core-js": "^2.4.1",
"es6-promise": "^4.0.5",
"es6-shim": "^0.35.2",
"less": "~2.7.1",
"lato-font": "2.0.0",
"primeui": "^4.1.15",
"primeng": "1.1.2",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.2",
"systemjs": "0.19.40",
"zone.js": "0.7.4",
"font-awesome": "4.7.0",
"moment": "2.17.1",
"chart.js": "2.4.0",
"@types/google.visualization": "0.0.33"
},
"devDependencies": {
"@types/jasmine": "^2.5.35",
"@types/node": "^6.0.45",
"concurrently": "^3.0.0",
"es-module-loader": "^1.3.5",
"angular-cli": "1.0.0-beta.24",
"codelyzer": "2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "^0.2.1",
"karma-requirejs": "^1.1.0",
"karma-spec-reporter": "0.0.26",
"karma-systemjs": "^0.16.0",
"requirejs": "^2.3.2",
"webdriver-manager": "11.1.0",
"typescript": "^2.0.10",
"ts-helpers": "^1.1.2",
"protractor": "4.0.14",
"ts-node": "2.0.0",
"tslint": "4.2.0"
}
}
爲什麼不使用最新版本的TypeScript? –
它與最新的CLI不兼容。請閱讀我提供的鏈接。 – Sebastian
這些鏈接指向人們聲稱降級TypeScript解決其問題的其他問題。它不適合如果'tsc -v'返回'2.0.10' –