Nicholaus Chipping
Nicholaus Chipping

Reputation: 324

Meteor - Using FS returns TypeError: Cannot read property 'Collection' of undefined

I am using Meteor 1.6 and AngularJS (Angular 1) and am having issues in my /server/main.js file. I am trying to do an import like this:

import { FS } from 'meteor/cfs:filesystem';

So Meteor is able to resolve it just fine, but the problem is, it is undefined somehow. So when I do this:

Images = new FS.Collection("images", {

I get the error mentioned above. I have been trying to find answers online and I've been referencing the Meteor Collection FS Documentation but haven't been able to resolve what I'm doing wrong with my import. Can anyone direct me how to fix this?

Upvotes: 6

Views: 215

Answers (3)

Nicholaus Chipping
Nicholaus Chipping

Reputation: 324

As pointed out on a Meteor forum, the trick with this one it to NOT import it. I don't know why I didn't try that before, but apparently the meteor/cfs:filesystem doesn't use api.export in their package.js file, so you can't import it. I was brought up to speed by robfallows in the Meteor forum

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222682

It should be as follows,

import { FS } from 'meteor/cfs:base-package';
import { FileSystem } from 'meteor/skaro:filesystem';

Upvotes: 0

Jassi Walia
Jassi Walia

Reputation: 75

Please try this import * as FS from 'meteor/cfs:filesystem'; instead of import { FS } from 'meteor/cfs:filesystem'

Upvotes: 0

Related Questions