agentmodels / webppl-agents

Webppl library for generating Gridworld MDPs. JS library for displaying Gridworld.
22 stars 4 forks source link

Where is webpplAgents defined? #54

Closed jsalvatier closed 8 years ago

jsalvatier commented 8 years ago

Its complaining that webpplAgents is not defined and I'm not sure where this name is supposed to come from.

jsalvatier commented 8 years ago

I'm having a lot of trouble with importing the javascript module, which seems to have stopped working.

When I run webppl --require . tests/regTests/agents.wppl, I get the following error

Processing tests/regTests/agents.wppl
undefined:140
    var GridWorld = webpplAgents;
                    ^

ReferenceError: webpplAgents is not defined
    at eval (eval at <anonymous> (/Users/jsalvatier/workspace/webppl/src/main.js:188:10), <anonymous>:140:21)
    at eval (eval at <anonymous> (/Users/jsalvatier/workspace/webppl/src/main.js:188:10), <anonymous>:4:21)
    at /Users/jsalvatier/workspace/webppl/src/main.js:188:44
    at Object.timeif (/Users/jsalvatier/workspace/webppl/src/util.js:222:37)
    at Object.run (/Users/jsalvatier/workspace/webppl/src/main.js:187:8)
    at run (/Users/jsalvatier/workspace/webppl/webppl:35:10)
    at main (/Users/jsalvatier/workspace/webppl/webppl:126:3)
    at Object.<anonymous> (/Users/jsalvatier/workspace/webppl/webppl:129:1)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

This is baffling to me because in the package.json, the javascript package does seem to be called webppl-agents, which I thought should cause the name of the module to be webpplAgents, but this doesn't seem to be the case. To make matters even more mysterious, one version of the repository seems to execute fine, but a freshly cloned version generates the error above (after running sh install.sh).

I'm pretty exhasperated about this. Any suggestions on what to look at @stuhlmueller or @owainevans ?

stuhlmueller commented 8 years ago

Which version of webppl are you using? Until recently, the name of the package directory was used (instead of the package name in package.json) for the variable referring to the package entry point. If your directory is called something other than webppl-agents and you're using an older version of webppl, that could be the cause of this issue. To fix this, upgrade to 17b4f3347d5df3457ffc9b59c7cfab43b95f9ce9.

jsalvatier commented 8 years ago

Hmm, I tried upgrading with npm install -g webppl and it didn't seem to change things. How do I check the webppl version?

On Thu, May 12, 2016 at 8:12 AM Andreas Stuhlmüller < notifications@github.com> wrote:

Which version of webppl are you using? Until recently, the name of the package directory was used (instead of the package name in package.json) for the variable referring to the package entry point. If your directory is called something other than webppl-agents and you're using an older version of webppl, that could be the cause of this issue. To fix this, upgrade to 17b4f3347d5df3457ffc9b59c7cfab43b95f9ce9 https://github.com/probmods/webppl/commit/17b4f3347d5df3457ffc9b59c7cfab43b95f9ce9 .

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/agentmodels/webppl-agents/issues/54#issuecomment-218788202

stuhlmueller commented 8 years ago

The version on npm doesn't have the fix yet. For the time being, it may be easier for you to try renaming your folder to webppl-agents and seeing whether that helps.

stuhlmueller commented 8 years ago

(To check the webppl version, run webppl --version.)

jsalvatier commented 8 years ago

Thanks andreas, updating worked out. :)

jsalvatier commented 8 years ago

Turns out we probably shouldn't update webppl untill the new version is released since there's bunch of breaking change.

So the fix to this problem is to make sure that your repository folder name is webppl-agents. I had not realized it was the repository folder name rather than the folder containing the .js file.