How to install local npm package in a project

In some cases, like for testing purposes, you might want to use an npm package stored on a local machine. Here is how you can do that with one simple command.
In typical case scenario you pass a published package name when installing it via npm:
npm install jquery
Let's say you have awesome-editor library written by yourself stored on your local machine under ~/projects/awesome-editor.
Installing it in your project is as simple as:
npm install ~/projects/awesome-editor
Once the installation is finished you will see a new entry in package.json:
"awesome-editor": "file:<relative path goes here>",
That's it, you can now use it in your project!
Related posts
Dive deeper into this topic with these related posts
You might also like
Discover more content from this category
Hey! Have you ever wondered about tests running inside the IEx shell? For a long time, I was convinced that it’s not really possible. And as it turns out - that’s not really straightforward. You won’t easily find information about that in the documentation.
So you don’t know what’s the type of struct you’re passing somewhere? Maybe it can be one of few types and you have to distinguish them? Or any other reason… But it’s about checking the struct type. Just use one of the coolest Elixir features - pattern matching!
Nowadays, with an ever-growing number of web services, we tend to overload Web apps with external resources. As a result, it decreases page load speed and affects SEO score. There is a pretty easy solution for that.
