csg
csg

Reputation: 2107

How npm detects which node packages are installed on a Windows machine?

I wonder if there is an explanation somewhere (maybe on node js website) about the next situation related to packages:

I guess that node searches for installed packages in all directories up to the root, but is somewhere in docs mentioned about it?

Upvotes: 0

Views: 253

Answers (2)

Igor Soarez
Igor Soarez

Reputation: 6822

If you look at Node.js' documentation, on the modules page - http://nodejs.org/api/modules.html - take a look at the sections:

  • Core Modules
  • File Modules
  • Loading from node_modules Folders

You'll find how require() is resolved.

Upvotes: 1

Menztrual
Menztrual

Reputation: 41597

Any globally installed modules (for exmaple: npm install -g express) are installed in C:\Program Files (x86)\nodejs\node_modules

Anything that has been locally installed (such as async, mysql), is placed in your directory inside a ./node_modules/ folder.

In this case, your backbone app has local dependancies, so its packages are installed locally inside d:\samples\backbone\node_modules

Upvotes: 2

Related Questions