Abdul
Abdul

Reputation: 261

Node.js install from local files

I made a modification to an npm package locally on my machine, and now I want to globally install the modified version, dependencies and all. How do I do that?

Upvotes: 3

Views: 2949

Answers (1)

rsp
rsp

Reputation: 111366

With npm install you can install a module specified by a directory instead of a name in the npm registry, see:

npm install (with no args, in package dir)
npm install [<@scope>/]<name>
npm install [<@scope>/]<name>@<tag>
npm install [<@scope>/]<name>@<version>
npm install [<@scope>/]<name>@<version range>
npm install <tarball file>
npm install <tarball url>
npm install <folder>

See the last 3 options - you can use a tarball file that you have prepared yourself, a tarball URL that you have hosted somewhere (like on GitHub), or a directory (folder) containing the module with package.json file.

If you are in the directory with your modified version, then you can install it globally with:

npm install -g .

Also, you can use npm link to create a globally-installed symbolic link from to the current folder, see:

This option can be convenient during development.

Upvotes: 5

Related Questions