cliff.meyers
cliff.meyers

Reputation: 17734

How can I change the default location for NPM installs on Windows?

When I install modules with NPM on Windows, it installs them to:

~/node_modules

I'd like to set change this to an arbitrary path such as:

c:\dev\repo\node_modules

I've tried

npm config set prefix <path>

With various values but none of them seem to work.

Upvotes: 9

Views: 4660

Answers (1)

mtsr
mtsr

Reputation: 3142

As mentioned in the FAQ npm installs modules locally, to avoid dependency conflicts with nesting dependencies. If you really want different projects to reference the same copy you can use npm link.

Upvotes: 4

Related Questions