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
- Host: GitHub
- URL: https://github.com/inigomarquinez/howto-install-a-local-package
- Owner: inigomarquinez
- License: mit
- Created: 2021-04-27T07:23:58.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T06:51:53.000Z (about 1 year ago)
- Last Synced: 2024-10-06T14:41:59.659Z (7 months ago)
- Language: JavaScript
- Size: 3.26 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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:

###
###
[](#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!