node.js - How to include other NPM modules when publishing to NPM? -


i trying publish first module npm, renders markdown ejs templating, uses 2 other npm modules marked , ejs, have these dependencies in package.json file. have .gitignore file contains node_modules directory, , .npmignore file empty.

i have published npm.

however when try install module putting package.json of test app , doing npm install -d installs, not install dependencies, if go test app root node_modules directory , newly published module's installed directory, has not installed of dependencies, has not have nested node_modules directory of own.

there should way module's dependencies install correct, when include express dependency, installs own node_modules folder connect , other modules installed, want same 2 other npm modules.

i know work if install nested node_modules dependencies, when works.

$ npm install -d $ cd node_modules/my_module $ npm install -d $ cd ../.. $ node app 

edit: here link github repo module, , here package.json.

edit: note, has happens when had dependencies marked , ejs installed in test app. when installed module, did not install marked , ejs in own node_modules directory. however, if remove modules test app , install module, install them. there anyway work regardless of whether dependencies have been installed beforehand.

it should "just work" is.

npm not install new modules, because sees there appropriate modules in node_modules directory @ higher level. because node's require tree, trying node_modules subdir each directory, module's require statements work, without having node_modules directory of own.

if you'd install module in place not have right dependencies installed, installed under module's own node_modules directory. alberto confirmes this.

you may want specify more specific version of dependencies in package.json though. ensure module gets use version of dependencies have tested with.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -