morphatic / astrologyjs

A NodeJs package that will provide core functionality for including astrological charts in projects.
MIT License
134 stars 46 forks source link

Issues importing module #1

Open DoctorHowser opened 8 years ago

DoctorHowser commented 8 years ago

Hi! I pulled your npm module, did a simple var chart = require('astrologyjs').Chart, and tried to run a basic nodejs server, and got a slew of issues.

1) You should tell people what version of node is required--I was on an older version and got the let keyword not currently supported error. 2)Your production code currently is not complied for node-- after getting around the node version issue, I got 'unexpected token export' error. I was forced to download babel and a couple of babels friends, run babel node-modules/astrologyjs/dist/astrologyjs.js to compile your file into my own script file, and then import that new file. Consequently, I had to copy your dependency of request-promise.

After all that, I finally could get a server running without even attempting to use your code, just import it.

I could be missing something basic, but since your readme doesn't say I needed any config or setup, I didn't think importing would be an issue. Please update your readme to explain how to install, or let me know if I've made a silly mistake.

Excited to use it!

morphatic commented 7 years ago

So, this is the first package I've ever published, and, as it turns out, I really had poor understanding of the build process. Six months later... I think I've finally got it working as expected. I don't know if you're still using it, but I'd love to hear if you are, what you're using it for and what kind of experience you're having.

DoctorHowser commented 7 years ago

Hi! I am still using it! I redid my app and things are much easier to work with, thank you!

I'm working on a phone app to compare people's charts. Still in its infancy, but super helpful to have this tool!

There seems now to be a problem making calls to your ephemeris service, ChartFactory is not working.

My (relevant) code:
function makeChart(person) {
    console.log("got to make chart")
    return ChartFactory.create("person Chart Test", person).then(
        c => {
            console.log("got through chartFactory")
            return c;
            // ... do stuff with your chart ...
        })
}

i never get into the .then-- the response causes an error. It's hard to say, but it looks like http://www.morphemeris.com/ephemeris.php is returning html? Here's the limited info I've got.

> undefined:1
> <html>
> ^
> 
> SyntaxError: Unexpected token < in JSON at position 0
>     at Object.parse (native)
>     at IncomingMessage.<anonymous> (C:\Users\Setup\IdeaProjects\express_passport_lecture_start\node_modules\astrologyjs\dist\astrologyjs.min.js:1:23201)
>     at emitNone (events.js:91:20)
>     at IncomingMessage.emit (events.js:185:7)
>     at endReadableNT (_stream_readable.js:975:12)
>     at _combinedTickCallback (internal/process/next_tick.js:74:11)
>     at process._tickCallback (internal/process/next_tick.js:98:9)

Normally I'd dive in and try to figure this out, but as I don't have access to the api, I'm kinda dead in the water. image

slissner commented 7 years ago

I follow this project as I am developing my own astrology app on the side (if time allows). For the lack of better communication channel: If you guys are interested in having a talk on this to combine energies, write me an email samuel.lissner@hotmail.com – Best, Samuel

IvanLisz commented 7 years ago

Same issue as @DoctorHowser

Any chance of getting ephemeris.php code? @morphatic

keel commented 7 years ago

The remote url looks down now, so I checked this: https://github.com/morphatic/morphemeris/blob/master/morphemeris.c

and I got the remote return json, like this: { 'planets': { "sun": { "name": "sun", "lon": 316.8179759783281, "lat": 0.00041081066655015915, "spd": 1.01033683800765, "r": 0 }, "moon": { "name": "moon", "lon": 326.02421725166124, "lat": -1.2666176341254307, "spd": 11.782161294263643, "r": 0 }, "mercury": { "name": "mercury", "lon": 334.2201904992024, "lat": 1.345486831196982, "spd": 0.4810680346881656, "r": 0 }, "venus": { "name": "venus", "lon": 301.8172829958925, "lat": -0.6337498106598883, "spd": 1.2511461089736275, "r": 0 }, "mars": { "name": "mars", "lon": 329.0166501740966, "lat": -1.041445081556629, "spd": 0.7880289690998868, "r": 0 }, "jupiter": { "name": "jupiter", "lon": 190.16361397143464, "lat": 1.4654571684782822, "spd": -0.03491850955337928, "r": 0 }, "saturn": { "name": "saturn", "lon": 189.49603895293401, "lat": 2.520865742829805, "spd": -0.030001211535495422, "r": 0 }, "uranus": { "name": "uranus", "lon": 239.77387282350992, "lat": 0.22525176977876282, "spd": 0.024723064602430133, "r": 0 }, "neptune": { "name": "neptune", "lon": 264.19271058658273, "lat": 1.308950473647586, "spd": 0.02556402940127581, "r": 0 }, "pluto": { "name": "pluto", "lon": 204.31516118606095, "lat": 17.343013961537736, "spd": -0.0057268650313539084, "r": 0 }, "mean_node": { "name": "mean_node", "lon": 130.62312516891404, "lat": 0, "spd": -0.05296203690929801, "r": 0 }, "chiron": { "name": "chiron", "lon": 43.50523450978042, "lat": -2.1174041928486895, "spd": 0.014075408630313023, "r": 0 }, "pholus": { "name": "pholus", "lon": 359.23817178523274, "lat": -21.31818577073963, "spd": 0.05628239590758445, "r": 0 }, "ceres": { "name": "ceres", "lon": 105.2414373502923, "lat": 9.622921376607543, "spd": -0.15234925229665233, "r": 0 }, "pallas": { "name": "pallas", "lon": 28.182609736689407, "lat": -30.621752668928114, "spd": 0.37007434912158393, "r": 0 }, "juno": { "name": "juno", "lon": 216.89360101291248, "lat": 6.977622609748791, "spd": 0.10343168211547572, "r": 0 }, "vesta": { "name": "vesta", "lon": 157.20224800902315, "lat": 8.371002153314997, "spd": -0.20587288904282722, "r": 0 }, "cupido": { "name": "cupido", "lon": 218.18660860229303, "lat": 1.0774662245965447, "spd": 0.00041483952822321594, "r": 0 }, "chariklo": { "name": "chariklo", "lon": 34.985301890501944, "lat": 22.96795814419131, "spd": 0.024185932939451166, "r": 0 }, "chaos": { "name": "chaos", "lon": 32.45982525503372, "lat": -3.3494148329614153, "spd": 0.008721131012466684, "r": 0 }, "eris": { "name": "eris", "lon": 14.207630934213647, "lat": -18.97308572742519, "spd": 0.006435380703867887, "r": 0 }, "nessus": { "name": "nessus", "lon": 110.997147580146, "lat": 16.27987763440593, "spd": -0.04106518701610671, "r": 0 } }, 'houses': [225.38677571201168, 254.92454492757463, 288.93542589286204, 324.743093634552, 357.11181085596854, 23.675867760699703, 45.38677571201168, 74.92454492757463, 108.93542589286204, 144.74309363455197, 177.11181085596854, 203.6758677606997 ], 'ascendant': 225.38677571201168, 'mc': 144.74309363455197 }

return this json instead of return rp_1.default({ uri: "http://www.morphemeris.com/ephemeris.php", qs: { date: date, lat: p.lat, lon: p.lng } }).then(function (cdata) { return cdata; }); now, the test can work fine.

keel commented 7 years ago

But the output is so big , I don't know how to draw a picture with that.