misoproject / dataset

JavaScript library that makes managing the data behind client-side visualisations easy
http://misoproject.com
GNU General Public License v2.0
1.18k stars 99 forks source link

Google Doc example fails in Node.js #200

Open mhkeller opened 11 years ago

mhkeller commented 11 years ago

When I run the example at http://misoproject.com/dataset/tutorials/googlespreadsheets in node after doing var Miso = require('miso.dataset') I get the following error in my console

/Users/mike/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2324
    var head    = document.head ||
                  ^
ReferenceError: document is not defined
    at Function.Dataset.Xhr.getJSONP (/Users/mike/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2324:19)
    at Function.Dataset.Xhr (/Users/mike/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2272:21)
    at _.extend.fetch (/Users/mike/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2242:15)
    at _.extend.fetch (/Users/mike/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:1029:21)
    at Object.<anonymous> (/Users/mike/code/gdoc-to-s3/miso.js:10:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
alexgraul commented 11 years ago

Interesting, that should be using request, will take a poke.

iwoj commented 11 years ago

Is there a fix for this? Miso doesn't seem to work with Node.js anymore.

iwoj commented 11 years ago

This is super annoying.

mhkeller commented 11 years ago

Any progress on this? I'd love to be able to start using Miso in my node projects.

mhilland commented 10 years ago

I'm experiencing the exact same issue. I can fetch and return data perfectly fine when creating my own array of objects inside Miso.Dataset, but when I try to specify a Google document via Miso.Dataset.Importers.GoogleSpreadsheet and Miso.Dataset.Parsers.GoogleSpreadsheet, it returns with this error:

/Applications/MAMP/htdocs/LB-BNR/meteor-aldoemail/.meteor/local/build/programs/server/boot.js:186 }).run(); ^ ReferenceError: document is not defined at Function.Dataset.Xhr.getJSONP (/Users/Max/.meteorite/packages/npm/arunoda/meteor-npm/177ab6118de5bf8cffb19481343d5762ff7a2aaf/.build/npm/node_modules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2324:19) at Function.Dataset.Xhr (/Users/Max/.meteorite/packages/npm/arunoda/meteor-npm/177ab6118de5bf8cffb19481343d5762ff7a2aaf/.build/npm/nodemodules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2272:21) at .extend.fetch (/Users/Max/.meteorite/packages/npm/arunoda/meteor-npm/177ab6118de5bf8cffb19481343d5762ff7a2aaf/.build/npm/nodemodules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:2242:15) at .extend.fetch (/Users/Max/.meteorite/packages/npm/arunoda/meteor-npm/177ab6118de5bf8cffb19481343d5762ff7a2aaf/.build/npm/nodemodules/miso.dataset/dist/node/miso.ds.deps.0.4.1.js:1029:21) at app/meteor-aldoemail.js:25:6 at app/meteor-aldoemail.js:48:3 at /Applications/MAMP/htdocs/LB-BNR/meteor-aldoemail/.meteor/local/build/programs/server/boot.js:155:10 at Array.forEach (native) at Function..each._.forEach (/Users/Max/.meteor/tools/c2a0453c51/lib/node_modules/underscore/underscore.js:79:11) at /Applications/MAMP/htdocs/LB-BNR/meteor-aldoemail/.meteor/local/build/programs/server/boot.js:82:5 => Exited with code: 8 => Your application is crashing. Waiting for file change.

oa495 commented 6 years ago

any update on this? does using node.js still work?