Npm.depends on a local npm package

Let’s say I am building my own Node NPM module and I want to include it inside a meteor package, is it possible to do this?

I tried adding something like the following to my package.js file but it produced an error when I booted the app.

		'/absolute/path/to/my/package': '0.x.x'

Does anyone know if this is supported and have you had any luck using it?

1 Like

I’ve been wondering the same thing. From various research I’ve done it appears meteor does not support local node modules. If anyone has been able to get local node modules to work, please share the wealth? Or if Meteor could confirm the intent of not allowing local node modules. Please :slight_smile:

Basically local modules don’t work b/c, there is a line in the build script that checks whether the package returns a result from the npm repository.

/meteor/tools/isobuild/meteor-npm.js which is part of the meteor build process has the following function

var installNpmModule = function (name, version, dir) { ... }

Within this function the buid runs a ‘npm install’ command based on a meteor copy of npm. This will return an error when the npm module returns a 404 from the public npm repo.


I’ve thought of forking meteor to override this behavior unfortunately maintaining a fork is a little too much overhead for me and the current plan is to meteor-ize the node module in question.

I figured it wasn’t possible. In my case, I was trying to debug the prerender-node npm module so on the authors suggestion, I cloned the function and overrode it, putting in a few logging messages to see what it was actually doing.

Ran into this issue as well, and currently it doesn’t look like it’s easy to get a local version of the NPM package running:

Hey @mizzao

I do this with file urls, e.g.:

  'meteor-babel': 'file:///home/dragon/www/npm/gadicc-meteor-babel'

I haven’t touched this in a while but from what I recall you need to restart Meteor to get it reload any changes, since no directory watching on a URL. Don’t recall if I tried to do a straight path, but a file url definitely works.

For within the project / for direct imports, I’ve been copying the directory over on changes because of iirc a symlink issue. I think I avoided npm link because I didn’t want a global install. I’ll check it out for you if these don’t work when I have a chance.


Thanks @dr.dimitru for the like :slight_smile: Will take this opportunity to ask you confirm if this still works? Because last time I tried it didn’t, but I didn’t look into it in depth.

Yes, it works. Used within npm link, but idk if it has any effect on it.

1 Like

I just want to confirm, that this method still works. I’ve created a PR for the Meteor guide to include this information.

And here it is:

Community management works great, big thanks to MDG!