我试图将Meteor 1.6.0.1中的Angular / Meteor应用更新到1.6.1。首先,我在此修复后执行此操作:https://github.com/Urigo/angular-meteor/pull/1889
我遇到的第一个问题是导入html文件作为Angular组件模板的旧方法:
import template from './home.component.html';
@Component({
selector: 'home',
template
})
export class HomeStartComponent { }
不再有效了。当我使用meteor启动应用程序时,无法找到模块' ./ XXXX.component.html'。"每个Angular组件都会打印一条消息。
第二个问题是我使用LESS作为CSS预编译器而here它表示你需要" meteor删除更少"为了使用Angular编译器。
我想确定如果我改变导入html模板的旧方法并对我的所有组件使用典型的Angular方式(templateUrl),并且我从LESS切换到SASS,应用程序将正常工作。
尽管在浏览器中启动应用程序时出现编译错误,但在开发控制台中显示以下错误:
Uncaught ReferenceError: __decorate is not defined
at app.js?hash=16f67970c82d7408c169d90e08545f5c0ba33acc:7411
at current-shop.service.js (app.js?hash=16f67970c82d7408c169d90e08545f5c0ba33acc:7415)
at fileEvaluate (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353)
at require (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248)
at admin-root.component.js (app.js?hash=16f67970c82d7408c169d90e08545f5c0ba33acc:3310)
at fileEvaluate (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353)
at require (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248)
at app.module.js (app.js?hash=16f67970c82d7408c169d90e08545f5c0ba33acc:7106)
at fileEvaluate (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:353)
at require (modules-runtime.js?hash=9f9bb5e055614ddf4eb3e743737b7a5b3cfd9d34:248)
这是我的Meteor版本文件:
accounts-base@1.4.2
accounts-facebook@1.3.1
accounts-google@1.3.1
accounts-oauth@1.1.15
accounts-password@1.5.1
alanning:roles@1.2.16
allow-deny@1.1.0
angular-compilers@0.2.9_3
angular-html-compiler@0.2.9
angular-scss-compiler@0.2.9_1
angular-typescript-compiler@0.2.9_7
autoupdate@1.4.0
babel-compiler@7.0.5
babel-runtime@1.2.2
base64@1.0.11
binary-heap@1.0.10
blaze@2.3.2
blaze-tools@1.0.10
boilerplate-generator@1.4.0
caching-compiler@1.1.11
caching-html-compiler@1.1.2
callback-hook@1.1.0
check@1.3.1
ddp@1.4.0
ddp-client@2.3.2
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.1.2
deps@1.0.12
diff-sequence@1.1.0
dynamic-import@0.3.0
ecmascript@0.10.5
ecmascript-runtime@0.5.0
ecmascript-runtime-client@0.6.2
ecmascript-runtime-server@0.5.0
ejson@1.1.0
email@1.2.3
es5-shim@4.7.3
facebook-oauth@1.4.0
geojson-utils@1.0.10
google-oauth@1.2.5
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.4.0
id-map@1.1.0
jalik:ufs@0.7.4_1
jalik:ufs-gridfs@0.2.1
jquery@1.11.11
launch-screen@1.1.1
livedata@1.0.18
localstorage@1.2.0
logging@1.1.20
matb33:collection-hooks@0.8.4
meteor@1.8.6
meteor-base@1.3.0
meteorhacks:aggregate@1.3.0
meteorhacks:collection-utils@1.2.0
minifier-css@1.3.1
minifier-js@2.3.3
minimongo@1.4.3
mobile-experience@1.0.5
mobile-status-bar@1.0.14
modules@0.11.5
modules-runtime@0.9.2
mongo@1.4.5
mongo-dev-server@1.1.0
mongo-id@1.0.7
mongo-livedata@1.0.12
npm-bcrypt@0.9.3
npm-mongo@2.2.34
oauth@1.2.1
oauth2@1.2.0
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.10.2
random@1.1.0
rate-limit@1.0.9
reactive-var@1.0.11
reload@1.2.0
retry@1.1.0
reywood:publish-composite@1.5.2
routepolicy@1.0.13
server-render@0.3.0
service-configuration@1.0.11
sha@1.0.9
shell-server@0.3.1
shim-common@0.1.0
socket-stream-client@0.1.0
spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.10
standard-minifier-css@1.4.1
standard-minifier-js@2.3.2
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tmeasday:check-npm-versions@0.3.2
tracker@1.1.3
underscore@1.0.10
url@1.2.0
webapp@1.5.0
webapp-hashing@1.0.9
和我的packages.json文件:
{
"name": "shop",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"@angular/animations": "^5.2.9",
"@angular/common": "^5.2.9",
"@angular/compiler": "^5.2.9",
"@angular/compiler-cli": "^5.2.9",
"@angular/core": "^5.2.9",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.9",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/platform-server": "^5.2.9",
"@angular/router": "^5.2.9",
"@babel/runtime": "^7.0.0-beta.42",
"@ng-select/ng-select": "^0.17.2",
"@types/googlemaps": "^3.30.8",
"@types/meteor-publish-composite": "0.0.32",
"angular2-meteor-polyfills": "^0.2.0",
"ap-angular2-fullcalendar": "^1.3.7",
"babel-runtime": "^6.26.0",
"bcrypt": "^1.0.3",
"bootstrap": "^3.3.7",
"chart.js": "^2.7.2",
"fullcalendar": "^3.9.0",
"gm": "^1.23.1",
"less": "^2.7.3",
"meteor-node-stubs": "~0.2.4",
"meteor-rxjs": "^0.4.10",
"moment": "^2.21.0",
"mydatepicker": "^2.6.3",
"mydaterangepicker": "^4.2.1",
"ng2-currency-mask": "^4.4.1",
"ng2-dnd": "^5.0.2",
"ngx-infinite-scroll": "^0.8.3",
"ngx-papaparse": "^1.2.5",
"node-schedule": "^1.3.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^5.5.7",
"spawn-sync": "^1.0.15",
"try-thread-sleep": "^1.0.2",
"typescript": "^2.7.2",
"typings": "^2.1.1",
"underscore": "^1.8.3",
"zone.js": "^0.8.20"
},
"devDependencies": {
"@types/chartjs": "0.0.31",
"@types/meteor": "^1.4.13",
"@types/underscore": "^1.8.8",
"meteor-typings": "^1.4.1"
}
}
这些是我得到的其他编辑错误:
node_modules/meteor-typings/1.4/test/test.ts (691, 5): Subsequent variable declarations must have the same type. Variable 'handle' must be of type 'LiveQueryHandle', but here has type '{ stop: () => void; }'.
node_modules/meteor-typings/1.4/test/test.ts (737, 24): Type '(userId: string) => boolean' has no properties in common with type 'Matcher'.
node_modules/rx/ts/core/es5.ts (3, 17): Duplicate identifier 'ObservableOrPromise'.
node_modules/rx/ts/core/es5.ts (5, 17): Duplicate identifier 'ArrayLike'.
node_modules/rx/ts/core/es5.ts (8, 17): Duplicate identifier 'ArrayOrIterable'.
node_modules/rx/ts/core/es6.ts (5, 17): Duplicate identifier 'ObservableOrPromise'.
node_modules/rx/ts/core/es6.ts (7, 17): Duplicate identifier 'ArrayLike'.
node_modules/rx/ts/core/es6.ts (10, 17): Duplicate identifier 'ArrayOrIterable'.
node_modules/rx/ts/core/es6.ts (20, 22): Interface 'IPromise<T>' cannot simultaneously extend types 'PromiseLike<T>' and 'Promise<T>'.
Named property 'then' of types 'PromiseLike<T>' and 'Promise<T>' are not identical.
node_modules/rx/ts/core/observer-extras.ts (65, 39): Property 'exception' does not exist on type 'Notification<number>'.
client/imports/app/not-found.component.ts (3, 22): Cannot find module './not-found.component.html'.
[client]: TypeScript Files Compilation: 51651.520ms
[server]: HTML Files Compilation: 0.163ms -
[server]: ES2015 modules Compilation: 1013.129ms
node_modules/rx/ts/core/linq/observable/pairs.ts (28, 5): Type 'Observable<[string, string]>' is not assignable to type 'Observable<[number, string]>'.
Type '[string, string]' is not assignable to type '[number, string]'.
Type 'string' is not assignable to type 'number'.
node_modules/rx/ts/core/linq/observable/pairs.ts (29, 5): Type 'Observable<[string, string]>' is not assignable to type 'Observable<[number, string]>'.
node_modules/meteor-typings/1.4/test/test.ts (691, 5): Subsequent variable declarations must have the same type. Variable 'handle' must be of type 'LiveQueryHandle', but here has type '{ stop: () => void; }'.
node_modules/meteor-typings/1.4/test/test.ts (737, 24): Type '(userId: string) => boolean' has no properties in common with type 'Matcher'.
node_modules/rx/ts/core/es5.ts (3, 17): Duplicate identifier 'ObservableOrPromise'.
node_modules/rx/ts/core/es5.ts (5, 17): Duplicate identifier 'ArrayLike'.
node_modules/rx/ts/core/es5.ts (8, 17): Duplicate identifier 'ArrayOrIterable'.
node_modules/rx/ts/core/es6.ts (5, 17): Duplicate identifier 'ObservableOrPromise'.
node_modules/rx/ts/core/es6.ts (7, 17): Duplicate identifier 'ArrayLike'.
node_modules/rx/ts/core/es6.ts (10, 17): Duplicate identifier 'ArrayOrIterable'.
node_modules/rx/ts/core/es6.ts (20, 22): Interface 'IPromise<T>' cannot simultaneously extend types 'PromiseLike<T>' and 'Promise<T>'.
Named property 'then' of types 'PromiseLike<T>' and 'Promise<T>' are not identical.
node_modules/rx/ts/core/observer-extras.ts (65, 39): Property 'exception' does not exist on type 'Notification<number>'.
server/admin/admin-reservations.publication.ts (368, 36): Property 'aggregate' does not exist on type 'Collection<Reservation>'.
server/admin/stats.methods.ts (43, 36): Property 'aggregate' does not exist on type 'Collection<Reservation>'.
server/admin/stats.methods.ts (84, 36): Property 'aggregate' does not exist on type 'Collection<Reservation>'.
server/admin/stats.methods.ts (125, 36): Property 'aggregate' does not exist on type 'Collection<Reservation>'.
server/admin/stats.methods.ts (168, 36): Property 'aggregate' does not exist on type 'Collection<Reservation>'.
server/reCAPTCHA.ts (32, 96): Argument of type '{ content: any; headers: { 'Content-Type': string; 'Content-Length': number; }; }' is not assignable to parameter of type 'HTTPRequest'.
Types of property 'headers' are incompatible.
Type '{ 'Content-Type': string; 'Content-Length': number; }' is not assignable to type '{ [id: string]: string; }'.
Property ''Content-Length'' is incompatible with index signature.
Type 'number' is not assignable to type 'string'.
[server]: TypeScript Files Compilation: 19101.137ms
=> Started your app.
=> App running at: http://localhost:3000/
我将不胜感激任何帮助。跟上Meteor版本是非常重要的。非常感谢你。
答案 0 :(得分:0)
更改为我的所有组件导入templateUrl的html模板以及从LESS切换到SASS的旧方法。该应用程序正在使用最新版本的Meteor。