我的角度2 / cli项目有问题。
我已经更新了我的npm软件包,但之后,当我使用ng服务时,我得到了这些错误:
Time: 12752ms
chunk {0} main.bundle.js, main.bundle.map (main) 45.3 kB {2} [initial] [rendered]
chunk {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 20.6 kB {3} [initial] [rendered]
chunk {2} vendor.bundle.js, vendor.bundle.map (vendor) 3.52 MB [initial] [rendered]
chunk {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
ERROR in AppModule is not an NgModule
ERROR in ./src/app/shared/guards/unauth-guard.ts
Module build failed: Error: /Users/nicolas/Desktop/Dilit/seller-app/src/app/shared/guards/unauth-guard.ts (16,8): Property 'take' does not exist on type 'AngularFireAuth'.)
at _checkDiagnostics (/Users/nicolas/Desktop/Dilit/seller-app/node_modules/@ngtools/webpack/src/loader.js:116:15)
at /Users/nicolas/Desktop/Dilit/seller-app/node_modules/@ngtools/webpack/src/loader.js:141:17
@ ./src/app/app.module.ts 23:0-59
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./src/app/shared/guards/auth-guard.ts
Module build failed: Error: /Users/nicolas/Desktop/Dilit/seller-app/src/app/shared/guards/auth-guard.ts (17,8): Property 'take' does not exist on type 'AngularFireAuth'.)
at _checkDiagnostics (/Users/nicolas/Desktop/Dilit/seller-app/node_modules/@ngtools/webpack/src/loader.js:116:15)
at /Users/nicolas/Desktop/Dilit/seller-app/node_modules/@ngtools/webpack/src/loader.js:141:17
@ ./src/app/app.module.ts 24:0-55
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./src/app/application/application.component.ts
Module not found: Error: Can't resolve 'application.frame.component.html' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application'
@ ./src/app/application/application.component.ts 39:18-61
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./src/app/application/dashboard/dashboard.component.ts
Module not found: Error: Can't resolve 'dashboard.component.html' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/dashboard'
@ ./src/app/application/dashboard/dashboard.component.ts 63:18-53
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./src/app/application/dashboard/dashboard.component.ts
Module not found: Error: Can't resolve 'dashboard.component.scss' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/dashboard'
@ ./src/app/application/dashboard/dashboard.component.ts 64:17-52
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./src/app/application/campaign/campaign.component.ts
Module not found: Error: Can't resolve 'campaign.component.html' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/campaign'
@ ./src/app/application/campaign/campaign.component.ts 81:18-52
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./src/app/application/campaign/campaign.component.ts
Module not found: Error: Can't resolve 'campaign.component.scss' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/campaign'
@ ./src/app/application/campaign/campaign.component.ts 82:17-51
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
webpack: bundle is now VALID.
即使我回到旧的package.json配置,我也无法构建我的项目。
这是我的package.json:
{
"name": "seller-app",
"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.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",
"@types/node": "^6.0.53",
"angularfire2": "^2.0.0-beta.7-pre",
"core-js": "^2.4.1",
"firebase": "^3.6.4",
"ng2-img-cropper": "^0.7.6",
"ng2-toastr": "^1.3.2",
"rxjs": "5.0.2",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.4"
},
"devDependencies": {
"@angular/compiler-cli": "2.4.1",
"@types/jasmine": "2.5.40",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.24",
"codelyzer": "~2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.7.0",
"karma": "1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.4.0",
"protractor": "4.0.14",
"ts-node": "2.0.0",
"tslint": "4.2.0",
"typescript": "~2.1.4",
"webdriver-manager": "11.1.0"
}
}
感谢您的帮助
答案 0 :(得分:0)
将TypeScript升级到2.1.4时出现了同样的错误。降级到TypeScript 2.1.1时存在错误。降级到TypeScript 2.0.8时,错误消失。