[英]Console error Meteor server side
I started Meteor and Angular2. 我启动了Meteor和Angular2。 On my server side (Meteor) I have a method file where I put some methods that I call in my client.
在服务器端(流星)上,我有一个方法文件,在其中放置了一些我要在客户端中调用的方法。 Obviously I need some meteor library so I import them like that :
显然我需要一些流星库,所以我像这样导入它们:
import {Meteor} from 'meteor/meteor';
import {check, Match} from 'meteor/check';
The thing is, in my console output I have the messages : 事情是,在我的控制台输出中,我收到以下消息:
server/imports/methods/methods.ts (4, 22): Cannot find module 'meteor/meteor'. server / imports / methods / methods.ts(4,22):找不到模块“流星/流星”。 server/imports/methods/methods.ts (8, 28): Cannot find module 'meteor/check'.
server / imports / methods / methods.ts(8,28):找不到模块“流星/检查”。
The line matches with the import. 该行与导入匹配。 Anyone has an idea to know where is this coming from ?
任何人都有一个想法知道这是从哪里来的?
This is just a TypeScript warning, it actually does not prevent your app from working, since Meteor still loads global variables anyway as of today. 这只是一个TypeScript警告,它实际上并不会阻止您的应用程序正常工作,因为到目前为止,Meteor仍在加载全局变量。
To avoid these messages, you have to provide your TypeScript compiler with proper meteor
typings, using a version that specifies the mentioned namespaces. 为了避免这些消息,您必须使用指定上述命名空间的版本为TypeScript编译器提供正确的
meteor
。
Eg get @types/meteor@>=1.4.0
, and make sure to tell TypeScript to use it. 例如,获取
@types/meteor@>=1.4.0
,并确保告诉TypeScript使用它。
$ meteor npm i --save-dev @types/meteor
In your tsconfig.json
: 在您的
tsconfig.json
:
{
"compilerOptions": {
"types": [
"@types/meteor"
]
}
}
Or in *.d.ts
file: 或在
*.d.ts
文件中:
/// <reference types="@types/meteor" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.