meteoris2 icon indicating copy to clipboard operation
meteoris2 copied to clipboard

ReferenceError: App is not defined

Open apaleja opened this issue 9 years ago • 10 comments

This is first time I am giving try to Meteoris, and I got these errors:

TypeError: Meteor.settings is undefined config.js:17:0 ReferenceError: App is not defined Images.js:8:0 ReferenceError: App is not defined mugenRoleActions.js:1:0 ReferenceError: App is not defined mugenRoleCollections.js:1:0 ReferenceError: App is not defined mugenRoleGroups.js:1:0 ReferenceError: App is not defined router.js:1:0

BTW, I am on windows.

apaleja avatar May 02 '15 14:05 apaleja

Same error on Linux Mint.

fsoldera avatar May 02 '15 20:05 fsoldera

@martinhbramwell : I think You should make clearer tutorial about this for starter users.

@apaleja & @fsoldera : thanks for reporting this. You can simply run meteor with this command

meteor --settings example.settings.json

This means, that you should setting up your meteor apps using your desired setting. Regards

radiegtya avatar May 04 '15 07:05 radiegtya

btw @martinhbramwell, did You mind if You restructure the settings.json? I think this structure will be easier to read, maintainable, and easier to switch between production and development without change the value every switch them.

{
  "APP_ENV": "development", //change to production when ready
  "development": {
    "public": {
      "APP_VERSION": "0.9.8.3",
      "APP_ID": "73xWmYM6nKmMa5ERB",
      "APP_NAME": "Meteoris",      
      "ACTIVATE_MUGEN" : true,
      "APP_SERVER": "http://localhost:3000",
      "MONGO_URL": "mongodb://localhost:3001/meteor/"
    },
    "private": {//YOUR ANOTHER SETTING}
  }, 
  "production": {
    "public": {
      "APP_VERSION": "0.9.8.3",
      "APP_ID": "73xWmYM6nKmMa5ERB",
      "APP_NAME": "Meteoris",      
      "ACTIVATE_MUGEN" : false,
      "APP_SERVER": "http://YOUR_DOMAIN",
      "MONGO_URL": "mongodb://YOUR_MONGO_USERNAME:YOUR_MONGO_PASS@localhost:27017/YOUR_MONGO_DBNAME"
     },
     "private": {//YOUR ANOTHER SETTING}
  }
}

What do you think?

nb: don't forget to change the config.js file too.

radiegtya avatar May 04 '15 07:05 radiegtya

The understandable rule is as defined in Meteor settings : If it is not explicitly public it is private. Internally, Meteor treats public vs private the way they want. It would be counter-productive to go against it :

Docs >> Full API >> Meteor.settings

martinhbramwell avatar May 04 '15 13:05 martinhbramwell

I am trying to solve the broader issue :

Meteor forum question : How to create Meteor.settings.public within my app?

martinhbramwell avatar May 04 '15 16:05 martinhbramwell

Hi @martinhbramwell, ok I am understand. But so many people asking me via email about this too. Would you mind to try fix the config.js? I think it will be better if people don't forced to setup the settings.json and give them the basic default setup at config.js too.

radiegtya avatar May 05 '15 00:05 radiegtya

I am trying to do that. The problem is your App construct!

I eliminated the original problem (the requirement to edit /lib/applications/meteoris/configs/config.js manually), without realizing that Meteor won't allow Meteor.settings.public to be altered by client-side code. I got no answer about this from the forum yesterday,. because the forum was broken.

Meanwhile, users must copy example.settings.json to settings.json then edit settings.json then run meteor --settings=settings.json

That is an idiomatic initialization step used by most open source applications.

Finally, the more I look at it the less your App construct makes sense. Why doesn't UI.registerHelper() simply return values from Meteor.settings?

martinhbramwell avatar May 05 '15 08:05 martinhbramwell

because not all people like to use Meteor.settings. And not much people know about it. hmm.. this weekend, I'll try to fix this thing up. If you don't mind, let's discuss more about it when you are free.

radiegtya avatar May 05 '15 11:05 radiegtya

I got an answer in the forum with the correct solution. Stupidly, I thought there was some magic about Meteor.settings. There isn't, on the client side at least one can tack any old thing onto the Meteor object,

https://forums.meteor.com/t/how-to-create-meteor-settings-public-within-my-app/3854

martinhbramwell avatar May 05 '15 18:05 martinhbramwell

I see, I'll merge and test it

radiegtya avatar May 06 '15 02:05 radiegtya