node.js - `npm link` works even when I do not `npm link <package_name>` in the desired directory -
i read npm documentation on npmjs.com linking local packages , says need in 2 steps:
- navigate local package dir , run
npm link
- navigate package in intened use package , run
npm link <package_name>
for example, if want use packageb
dependency in packagea
, need go packageb
's directory, run npm link
, npm link packageb
in packagea
's directory.
however, in practice, when npm link
in packageb
's directory , require('packageb')
inside packagea
, works, , changes in packageb
instantly reflected in packagea
.
can tell me how happening?
in fact when 'npm link', create link package globally on system (you know it's when "npm install -g xxx").
and when require package via node checks @ many directory (the current node_modules, parent ... & global directory )
Comments
Post a Comment