developerasun / myCodeBox-web

Open source code box for web developers.
Apache License 2.0
5 stars 0 forks source link

[RESEARCH] Javascript/package manager: npm link #266

Open developerasun opened 2 years ago

developerasun commented 2 years ago

topic : understanding link command in npm

read this

npm link [<package-spec>]
# alias: ln

This is handy for installing your own stuff, so that you can work on it and test iteratively without having to continually rebuild.

Package linking is a two-step process.

First, npm link in a package folder with no arguments will create a symlink in the global folder {prefix}/lib/node_modules/ that links to the package where the npm link command was executed. It will also link any bins in the package to {prefix}/bin/{name}. Note that npm link uses the global prefix (see npm prefix -g for its value).

Next, in some other location, npm link package-name will create a symbolic link from globally-installed package-name to node_modules/ of the current folder. Note that package-name is taken from package.json, not from the directory name.

The package name can be optionally prefixed with a scope. See scope. The scope must be preceded by an @-symbol and followed by a slash.

reference