I followed the github meteorirc project project and put them in / public /
I installed my node modules through npm from inside / public /, and so I have a directory / public / node_modules /.
I don’t think this is the “right” or “standard” place for them, because according to the Meteor docs ...
Meteor collects all your JavaScript files except client and public subdirectories and uploads them to the Node.js server instance inside the fiber
The download code is in the dir and server files of the js server and looks like this.
var require = __meteor_bootstrap__.require; var path = require("path"); var fs = require('fs'); var base = path.resolve('.'); if (base == '/'){ base = path.dirname(global.require.main.filename); } var Twit; var twitPath = 'node_modules/twit'; var publicTwitPath = path.resolve(base+'/public/'+twitPath); var staticTwitPath = path.resolve(base+'/static/'+twitPath); if (path.existsSync(publicTwitPath)){ Twit = require(publicTwitPath); } else if (path.existsSync(staticTwitPath)){ Twit = require(staticTwitPath); } else{ console.log('WARNING Twit not loaded. Node_modules not found'); }
Based on the docs, this is not a standard, and I don't think I should do it that way. However, it works both on my dev platform and in production when deploying meteor.com.
Where should node modules be installed in the project directory structure so that they work locally and after deployment on meteor.com or elsewhere?
javascript meteor
Steeve Cannon May 14 '12 at 17:08 2012-05-14 17:08
source share