meteor was working pre 0.6.5, but has stopped working since I updated. What would cause this error? Note that I have what I assume are the latest of stripe, fibers, and meteor.
> npm ls stripe /path/to/project └── email@example.com > npm -g ls fibers /usr/local/lib └── firstname.lastname@example.org > meteor --version Release 0.6.5.1 > meteor [[[[[ /path/to/project ]]]]] => Meteor server running on: http://localhost:3000/ W20130909-13:34:19.787(-7)? (STDERR) /Users/pabo/.meteor/tools/3cba50c44a/lib/node_modules/fibers/future.js:173 W20130909-13:34:19.867(-7)? (STDERR) throw(ex); W20130909-13:34:19.867(-7)? (STDERR) ^ W20130909-13:34:19.868(-7)? (STDERR) ReferenceError: require is not defined W20130909-13:34:19.868(-7)? (STDERR) at app/node_modules/stripe/test/charges.js:1:47 W20130909-13:34:19.868(-7)? (STDERR) at app/node_modules/stripe/test/charges.js:65:3 W20130909-13:34:19.868(-7)? (STDERR) at mains (/path/to/project/.meteor/local/build/programs/server/boot.js:153:10) W20130909-13:34:19.868(-7)? (STDERR) at Array.forEach (native) W20130909-13:34:19.869(-7)? (STDERR) at Function._.each._.forEach (/Users/pabo/.meteor/tools/3cba50c44a/lib/node_modules/underscore/underscore.js:79:11) W20130909-13:34:19.869(-7)? (STDERR) at /path/to/project/.meteor/local/build/programs/server/boot.js:80:5 => Exited with code: 1
preguntado el 09 de septiembre de 13 a las 21:09
Whatever you place in your project folder is considered a part of your Meteor application (with the only exception of
/tests folder). That includes npm packages you install inside
npm_modules. And most of the time plain npm packages are not designed to work inside Meteor file structure, hence they throw errors all over the place.
npm install package in upper level directory, or manually moving
npm_modules higher in the structure is a bad idea either. That way you create an application that only works on your machine, as it depends on specific version of a npm package, and that dependency is nowhere stated. You'll run into problems during deployment. On a VPS you'd need to install the same packages, for Heroku you'd need a custom buildpack, and so on.
The correct way to use npm packages in Meteor app is currently
npm meteorite package. It's easy to use and well documented under that link.
I don't exactly understand why, but I had to move my node_modules up a few directories to get this working again. I had done an
npm install stripe
in my main meteor project directory, which is apparently a bad thing. I'd still love to hear from people smarter than I about what exactly as going on, and what exactly I misunderstood to cause this in the first place.