Closed ghost closed 8 years ago
It's definitely a typo in the test code. From the JSON and attempt to call:
- Worldstate
From the require:
+ WorldState
Capitalization win.
Feel free to contact me on Discord if you'd like, and you use the application.
My id is Tobiah#8452
I ran the preview code again, following the steps you said it still gave me the same error, so I tried the following:
var Worldstate = require('warframe-worldstate-parser');
var worldStates = {
PC : new WorldState('PC'),
PS4 : new WorldState('PS4'),
X1 : new WorldState('X1'),
}
var primeAccess = null;
worldStates[PC].getPrimeAccessString(function(err, primeAccessObject) {
if (err) {
return console.err(err);
}
primeAccess = primeAccessObject;
});
This resulted in the following error:
hidden for obvious reasons\node_modules\warframe-worldstate-parser\src\modules\news.js:14
for (var index = 0; index < data.length; index++){
^
TypeError: Cannot read property 'length' of undefined
at new News (hidden for obvious reasons\node_modules\warframe-worldstate-parser\src\modules\news.js:14:35)
at new WorldState (hidden for obvious reasons\node_modules\warframe-worldstate-parser\src\worldstate.js:23:15)
at Object.<anonymous> (hidden for obvious reasons\try.js:3:8)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
Hope this helps
EDIT: Grammar fixes
doesn't particularly help at all.
Are you allowing node access to the internet?
Node has internet access, I tried both the github master branch and the npm version Both seem to give the exact same error
I even tried to run it on RunKit, and got the same errors Using the following code
require("warframe-worldstate-data");
require("warframe-worldstate-parser");
var worldStates = {
PC : new WorldState('PC'),
PS4 : new WorldState('PS4'),
X1 : new WorldState('X1'),
}
var primeAccess = null;
worldStates[platform].getPrimeAccessString(function(err, primeAccessObject) {
if (err) {
return console.err(err);
}
primeAccess = primeAccessObject;
});
With and without caps WorldState
.
Just to make sure that I didn't experience a bad install of some sorts.
One thing to note tho: whilst running the code on RunKit without require 'warframe-worldstate-data'
it gave me the following error Cannot find module 'warframe-worldstate-data'
.
Hope this provided you with enough info to fix the problem.
EDIT: added RunKit info
on the data module, you have to install it separately if you're going to use it in that manner because parser pulls it in on its own. In addition, it doesn't look like you're setting the result of the require to anything, which is why you can't access any of it's properties.
where you do
primeAccess = primeAccessObject;
change it to
console.log(primeAccessObject);
just to see what you get if the code ever reaches there.
RunKit probably doesn't pull in the transitive dependencies correctly, would be my guess.
Your suggestion still gave me the same error regarding news.js, So I tried to comment every inclusion of news.js and ran it but this time it gave me an error of sorties.js. Both news.js and worldstate.js run perfectly fine alone, but if I try to call them via the readme example it just gives the usual error of undefined .length
Sorry I haven't helped you in so long. Have you been able to figure anything out?
Havn't been able to figure anything new out. Only thing to note is that when I comment out sortie.js it then continous to give me an error of the next require which in this case is globalModifiers.js. The error usually contains an undefined length of the data array. I will try to uninstall and reinstall the package to see if the problem reoccurs.
EDIT: Reinstalling didn't fix anything it resulted in the same old error. I'll try c9 just to make sure it isn't the pc I'm using itself. Could you try to install it in a different folder and run the sample code? Then we could hopefully obtain more information regarding the error. C9 resulted in the same error.
Just so you know, I haven't forgotten, I'm looking into it still and working on reproducing your error.
Feel free to hit me up on Discord, if you have the time.
@Cp-022 I got it figured out. I'm updating the sample doc, because this was totally a flub on my part.
Got it working, thanks for the patience!
No problem, I'm sorry it took me so long to find that.
Tried to test how it works (since there isn't much to read about) by running the code provided by the README
Sadly after running it I got the following error
I'm sorry if I misunderstood something of the code that is provided.
EDIT: Grammar and markup fix