0

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/cli@4.1.2 -> /home/ole/SuperflyCSS/cli
    │ ├─┬ @superflycss/pli@3.0.0

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.

Ole
  • 41,793
  • 59
  • 191
  • 359

1 Answers1

1

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".

Porlune
  • 740
  • 6
  • 16
  • 1
    Cool! This explains a lot. Looks like it's `/usr/lib/node_modules` on Ubuntu. Found it by running `find / -xdev 2>/dev/null -name "@superflycss"` – Ole Jan 20 '19 at 01:20