Meteor Tutorials Don't Work with Meteor Workspace

meteor

#1

Trying to run the Meteor “simple todos” tutorial isn’t possible with the default Meteor workspace: https://www.meteor.com/tutorials/blaze/creating-an-app


#2

I been working with a similar tutorial and I am having problems too. Specifically with the connection of the MongoDB. All other stuff works fine, but without the Mongo connection it becomes pointless. The application does not seem to recognize the currently running MongoDB and I can’t figure how to make it work. I have spent two days reading all kinds of stuff on line and nothing seems to work here.
I anyone has some ideas…


#3

Hi,

Thanks for writing in! Please post all relevant information about the issue so we can help you better. Things like screenshots, error logs, pertinent code snippets or anything else you deem useful in order to reproduce / debug the issue you’re facing.

Thanks! :slight_smile:

Regards,
​Mutahhir


#4

The image shows that the file.js has a new Mongo.Collection(text) instruction and says that Mongo is not defined… I have attempted to input something on the file and it will report an error on that…
I should be able to create the MongoDB through the command line, or insert documents into it from the command line and it does not work…


#5


#6

Hi,

Thanks for the information. Usually node throws that error when a variable is referenced but isn’t defined yet. In your case, you’re probably missing an import statement like:

import { Mongo } from 'meteor/mongo';

(from: https://www.meteor.com/tutorials/blaze/collections).

Regards,
Mutahhir


#7

Tanks for the response.

I have done that before and did not work.


#8

What is the error when you do add that?


#9

Your code is running at https://lead-rojour.c9users.io.
Important: use process.env.PORT as the port and process.env.IP as the host in your scripts!

Debugger listening on port 15454
/home/ubuntu/workspace/client/main.js:1
(function (exports, require, module, __filename, __dirname) { import { Mongo } from ‘meteor/mongo’;
^^^^^^

SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.runMain [as _onTimeout] (module.js:441:10)
at Timer.listOnTimeout (timers.js:92:15)

Process exited with code: 1


#10

Ok, so from the example, I assumed (sorry, I don’t have any recent meteor experience), that meteor came bundled with Babel (or somehow supported ES6 syntax).

If you’re not using ES6 modules in your app, you can try:

Meteor = require("meteor/mongo").Meteor

instead. That should (probably :slight_smile: ) work.

If that doesn’t help, I’m afraid the question would be more suited to StackOverflow, or the Meteor forums, as it doesn’t seem related to Cloud9.

Regards,
​Mutahhir


#11

Thanks. I have looked for that and can’t figure it out. I’ll keep trying.


#12

I spent most of the last two days searching on StackOverflow, and other forums without success. Just a few minutes ago I found that someone in StackOverflow had suggested to move the project.js file from the client folder into a lib folder (not created automatically) and that solved the problem. Now the MongoDB is getting the inserts and keeping them without reporting an error.

Thanks for your help.