node.js - how to specify local modules as npm package dependencies -
i have application has usual set of dependencies on third party modules (e.g. 'express') specified in package.json file under dependencies. e.g.
"express" : "3.1.1"
i structure own code modularly , have set of local (meaning on file system in) modules installed package.json. know can install local module running:
npm install path/to/mymodule
however, don't know how make happen via package.json dependencies structure. using --save
option in command putting "mymodule": "0.0.0"
package.json (doesn't reference filepath location). if remove installed version node_modules, , try re-install package.json, fails (because looks "mymodule" in central registry, , doesn't locally).
i'm sure way of telling "dependencies": {}
structure want installed file system path, don't know how.
anyone else had problem? thanks.
as of npm 2.0.0, importing local dependencies supported natively. documented danilopopeye in response similar question. i've copied response here needing find correct answer, question ranks highly in google's search results.
this feature implemented in version 2.0.0 of npm. example:
{ "name": "baz", "dependencies": { "bar": "file:../foo/bar" } }
any of following paths valid:
../foo/bar ~/foo/bar ./foo/bar /foo/bar
Comments
Post a Comment