probmods / webppl

Probabilistic programming for the web
http://webppl.org
Other
619 stars 86 forks source link

Fix typo in gradient.js require #874

Closed superlaza closed 7 years ago

superlaza commented 7 years ago

On L2:C21 of src/inference/dream/gradient.js

var ad = require('..../ad');

is missing a forward slash.

superlaza commented 7 years ago

Fix on dev branch, broken on npm release

null-a commented 7 years ago

Hi, thanks for mentioning this.

gradient.js is automatically generated from gradient.ad.js when the package is installed, and it's possible the ad import is getting messed up as part of that.

I've just installed the latest npm release locally, after which gradient.js was correct for me. Would you be able to uninstall/reinstall the webppl package and check whether the require in gradient.js is still wrong? If so, perhaps this is a problem specific to a particular node version or OS etc.

Thanks!

sergeiwallace commented 7 years ago

I just installed webppl through npm and it threw an error because of the var ad definition on line 2 in gradients.js.

> webppl test.wppl
module.js:529
    throw err;
    ^
 
Error: Cannot find module '..../ad'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\user_name\AppData\Roaming\npm\node_modules\webppl\src\inference\dream\gradients.js:2:10)

The ad variable was defined twice, though, so I just commented out the first one and it now works.

use strict';
//var ad = require('..../ad'); //caused error
var assert = require('assert');
var _ = require('lodash');
var guide = require('../../guide');
var ad = require('../../ad');
module.exports = function (env) }
null-a commented 7 years ago

@spw1016 Thanks for reporting this! Looks like there might be a problem in Windows, I'll look into it.