What is the proper syntax to add local project dependency in npm package.json
file?
I have git project locally in C:\projects\MyApp
I want to get this project with npm install
. I tried following
"dependencies": {
.....
"my-app": "file://../projects/MyApp/MyApp.git"
.....
}
but getting error
Could not install ....
Any suggestion?
Finally got it working
"my-app": "../projects/MyApp"
Its' simple until you know.
Local dependency has to be a directory on your filesystem.
Alternately there is npm-link.
Excerpt from the docs:
Package linking is a two-step process.
First, npm link in a package folder will create a globally-installed symbolic link from prefix/package-name to the current folder (see npm-config for the value of prefix).
Next, in some other location, npm link package-name will create a symlink from the local node_modules folder to the global symlink.
Example:
cd ~/projects/node-redis # go into the package directory npm link # creates global link cd ~/projects/node-bloggy # go into some other package directory. npm link redis # link-install the package
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With