Can someone please tell me what the recommended way to use a node.js package that one would install with npm locally (npm without -g option)?
One way someone recommended was:
% cd myapp/.meteor/local/build/server/
% npm install aws-lib
npm http GET https://registry.npmjs.org/aws-lib
npm http 304 https://registry.npmjs.org/aws-lib
npm ERR! Could not create /home/user/myapp/.meteor/local/build/server/node_modules/___aws-lib.npm
This fails because myapp/.meteor/local/build/server/node_modules is symlinked to /usr/lib/meteor/lib/node_modules/.
I want to install it locally for a several reasons. I want it to be portable as in, if I deploy the app somewhere else, I want all the dependencies to travel with it. I don't want to do this as root. It seems wrong to install stuff like this into /usr/lib/meteor.
meteor bundle bundle.tar.gz to get a node-deployable package of your app.tar -xvf bundle.tar.gz and cd bundle.server directory there is a node_modules directory.cd server & npm install aws-libThis is a deployment-ready package. Call node bundle/main.js to start it.
To actually use the module, you will have to call __meteor_bootstrap__.require.
Checkout this for a more detailed solution! http://stackoverflow.com/a/12730509/1757994
Alternatively, you can wrap the node module as a package that includes the module's code and the __meteor_bootstrap__.require line. This is a good example of a simple shim:
https://github.com/tmeasday/meteor-page-js
And this is an example of a shim around a node module:
https://github.com/possibilities/meteor-awssum
I suspect this is the package you wanted in the first place...