Installing a Local Module Using Npm?
I Have a Downloaded Module Repo, I Want to Install It Locally, Not Globally in Another Directory? What Is an Easy Way to Do This? 9 Answers You Just Provide...
I have a downloaded module repo, I want to install it locally, not globally in another directory?
What is an easy way to do this?
9 Answers
you just provide one <folder> argument to npm install, argument should point toward the local folder instead of the package name:
npm install /path
From the npm-link documentation:
In the local module directory:
$ cd ./package-dir
$ npm link
In the directory of the project to use the module:
$ cd ./project-dir
$ npm link package-name
Or in one go using relative paths:
$ cd ./project-dir
$ npm link ../package-dir
This is equivalent to using two commands above under the hood.
Since asked and answered by the same person, I'll add a npm link as an alternative.
from docs:
This is handy for installing your own stuff, so that you can work on it and test it iteratively without having to continually rebuild.
cd ~/projects/node-bloggy # go into the dir of your main project
npm link ../node-redis # link the dir of your dependency
[Edit] As of NPM 2.0, you can declare local dependencies in package.json
"dependencies": {
"bar": "file:../foo/bar"
}
npm pack + package.json
This is what worked for me:
Must Read
STEP 1: In module project, execute npm pack:
This will build a <package-name>-<version>.tar.gz file.