在角度2+流星中已经有一个名为"collection"的集合



import {Mongo} from 'meteor/mongo'; export let Products = new Mongo.Collection('products');

上面的

代码是我在我的示例项目中编写的。当我尝试运行这个示例项目时,它抛出错误

已经有一个名为"products"的集合

我试过meteor reset。我仍然面临着同样的问题。我谷歌了一下,但没有找到合适的解决方案。有人能帮我吗?

前几天我也遇到了同样的问题。我使用我的tsconfig.json

的这一部分来解决它
"atom": {
    "rewriteTsconfig": true
  },
  "compileOnSave": false,
  "buildOnSave": false,
  "compilerOptions": {
    "experimentalDecorators": true,
    "module": "commonjs",
    "target": "es5",
    "isolatedModules": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "removeComments": false,
    "noImplicitAny": false,
    "sourceMap": true
  },
  "filesGlob": ...

我也删除了所有的。js和。js。从我的工作目录映射文件。正如@KRONWALLED已经提到的,当您使用自动编译.ts文件的IDE时,就会出现问题。当您使用原子typescript包时,这可能是自动编译您的.ts文件。这就是你得到这个错误的原因。tsconfig中的重要行。json文件是

"compileOnSave": false,

声明编译器不应该在保存时编译文件。只有当流星运行时,文件才会用流星编译。

相关内容

最新更新