Alfred
Alfred

Reputation: 61803

npm install locally

In the past when I installed packages using npm(>=1.0) they would be installed locally, but not anymore.

My setup:

Installing random package

alfred@alfred-laptop:~/node/so/6513101$ npm install notifo
[email protected] ../../../node_modules/notifo 

In the past it would install into the same directory but it does not install in the same directory anymore. is my npm/node.js broken or am I missing something or does npm not anymore install local packages(inside same folder => ~/node/so/6513101/node_modules) which I thought was a cool feature because I could bundle all my dependencies so that other users did not have to install npm to use my code(I still believe users should install npm because it is a great product). The bundle command is gone so I can't use that? Could someone please explain to me what is going on?

Upvotes: 22

Views: 29673

Answers (1)

isaacs
isaacs

Reputation: 17180

npm walks up the folder tree until it finds a node_modules or a package.json and uses that as the root. What does npm root print out?

If you mkdir node_modules or create a package.json file, then it'll use the cwd.

EDIT: I won't see updates you post here. For better results, just post everything in the github issue, and let's do the support over there.

Upvotes: 61

Related Questions