`npm link --save` does not update dependencies on my package.json

I use npm link package --saveto create a local link to a globally installed package.

It correctly creates a link to the package (and will install it globally if it is not already installed); but it does not update dependencies in package.json.

What am I missing here?

+4
source share
3 answers

According to npm docs is npm link not intended to change yours package.json. It creates symbolic links in your file system for the package.

This allows you to still reference the module by name, but pull it out of the local file system:

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

package.json, npm install :

npm install --save /path/to/package

package.json:

"dependencies": {
  "local-package": "file:/path/to/package"
}

, npm link , package.json . , .

+2

: npm-link-save

npm-link-save

npm-link --save ( --saveDev), package.json.

.

Installation

npm i -g npm-link-save

Using

npm-link-save express
# or
npm-links express
npm-links -D express // links in devDependencies
npm-links express morgan // multiple links
0
source

All Articles