Does a global install of a local node project just create executable links back to the project?

59 views Asked by At

I'm doing some work on a command line interface, and to test it from the root of the project I do:

npm i -g

After this I can test the command on various projects.

IIUC running npm i -g creates global links that are executable, but the actual files being run are the original project files?

Running:

    ole@mki:~/SuperflyCSS/cli$ npm list -g | grep superfly
    ├─┬ @superflycss/[email protected] -> /home/ole/SuperflyCSS/cli
    │ ├─┬ @superflycss/[email protected]

Seems to indicate that this is the case.

I just want to triple check because I'm getting an odd scenario where it looks as if NPM is making a copy.

This issue is related to this issue.

1

There are 1 answers

1
Porlune On BEST ANSWER

Globally installed modules are placed in "/usr/local/lib/node_modules" (or its equivalent on your system, which you can find by running "npm list -g").

As for the binaries that are globally installed, symbolic links to them are placed in "/usr/local/bin", but you can find out where they are on your system by using "npm bin -g".

For example, browserify installed to "/usr/local/lib/node_modules/browserify", and has a "/bin/cmd.js" file that is linked as:"/usr/local/bin/browserify->/usr/local/lib/node_modules/browserify/bin/cmd.js".