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

只谈情不闲聊 提交于 2019-12-11 14:18:51

问题


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.


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



来源:https://stackoverflow.com/questions/54270592/does-a-global-install-of-a-local-node-project-just-create-executable-links-back

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!