An open API service indexing awesome lists of open source software.

https://github.com/inigomarquinez/howto-install-a-local-package

KS on how to install a local package
https://github.com/inigomarquinez/howto-install-a-local-package

Last synced: 27 days ago
JSON representation

KS on how to install a local package

Awesome Lists containing this project

README

        

# [HOWTO] Install a local package

This is a demo repository to show different alternatives on how we can install a **local** package and *publish* it locally so it can be installed on another project without having to publish it at [npm](https://www.npmjs.com/) to test it.

The demo consists of two repositories:

- [This repo](https://github.com/inigomarquinez/howto-install-a-local-package) contains the project that will use the package locally installed.
- [This repo](https://github.com/inigomarquinez/howto-develop-a-package-locally) contains the local package we want to iteratively test.

## Alternatives

### [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link)

This npm command creates a symlink to a package folder.

Package linking is a two-step process:

1. First, `npm link` in a package folder will create a symlink in the global folder `{prefix}/lib/node_modules/` that links to the package where the npm link command was executed. It will also link any bins in the package to `{prefix}/bin/{name}`.

2. Next, in some other location, `npm link package-name` will create a symbolic link from globally-installed package-name to `node_modules/` of the current folder.

In our case, we need to run these commands when located in the roor folder of this repository to be able to use the local package:

```bash
npm link @ks/my-local-package # link-install the package
```

Take a look at the following image, where we can see that after running `npm link @ks/my-local-package` we can find in the `node_modules` folder a symlink to the local package:

![symlink](assets/symlink.png)

###

###

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



Íñigo Marquínez

💻

Jorge Baumann

💻

robertoHeCi

💻

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!