¿Qué pasa con mis paquetes de meteoritos/meteoritos "requerir no está definido"?

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
└── stripe@1.3.0 

> npm -g ls fibers
└── fibers@1.0.1 

> meteor --version

> 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

2 Respuestas

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.

Running 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.

Respondido 08 Abr '14, 05:04

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.

Respondido el 09 de Septiembre de 13 a las 22:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.