Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js install from local files

Tags:

node.js

npm

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?

like image 693
Abdul Avatar asked Jul 15 '26 11:07

Abdul


1 Answers

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

  • https://docs.npmjs.com/cli/install
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:

  • https://docs.npmjs.com/cli/link

This option can be convenient during development.

like image 198
rsp Avatar answered Jul 20 '26 10:07

rsp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!