Installing a local module using npm?
you just provide one <folder>
argument to npm install
, argument should point toward the local folder instead of the package name:
npm install /path
How to specify local modules as npm package dependencies
npm install
now supports this
npm install --save ../path/to/mymodule
For this to work mymodule
must be configured as a module with its own package.json
. See Creating NodeJS modules.
As of npm 2.0, local dependencies are supported natively. See danilopopeye's answer to a similar question. I've copied his response here as this question ranks very high in web search results.
This feature was implemented in the version 2.0.0 of npm. For example:
{
"name": "baz",
"dependencies": {
"bar": "file:../foo/bar"
}
}
Any of the following paths are also valid:
../foo/bar
~/foo/bar
./foo/bar
/foo/bar
syncing updates
Since npm install <folder>
adds the package in the directory as a symlink in the current project any changes to the local package are automatically synced.
NodeJS - installing local module
You can create a tarball from your-local-module
with npm-pack and then install it offline using npm-install:
npm install <tarball file>
Install a package that is sitting on the filesystem. Note: if you just want to link a dev directory into your npm root, you can do this more easily by using npm link. The filename must use .tar, .tar.gz, or .tgz as the extension.
How to install a npm module in current directory?
I asked this back when I was a terminal noob.
The solution was simple:
cd (navigate using the command line) to the directory you want to install the module in and then it should work fine. It is a good idea to npm init
first.
Related Topics
Transforms Are Added...Endlessly
Show Dynamically Added Navlinks When Added in Bootstrap Navbar
Changing Pseudo-Element Style from JavaScript
Multiline Typewriter Effect with Two Consistent Words
How to Generate an APK That Can Run Without Server with React-Native
JavaScript Alert Not Working in Android Webview
Why Can't JavaScript .Play() Audio Files on iPhone Safari
How to Detect in iOS Webapp When Switching Back to Safari from Background
How Does Linux Emulator in JavaScript by Fabrice Bellard Work
JavaScript Equivalent of Ruby's String#Scan
What Blocks Ruby, Python to Get JavaScript V8 Speed
Is Ruby Strongly or Weakly Typed
Regex Match Count of Characters That Are Separated by Non-Matching Characters
Parsing JavaScript Using Ruby Code
How to Use .Env Variables in Nuxt 2 or 3
Is There a Link to the "Latest" Jquery Library on Google APIs
JSON Datetime Between Python and JavaScript
Browsers Automatically Evaluate Hex or Hsl Colors to Rgb When Setting via Element.Style.Background