简体   繁体   English

查找链接 NPM package

[英]Find linked NPM package

I have a bizarre issue.我有一个奇怪的问题。

I have written a package for Node for local use, and used NPM link to make it available for command line use globally.我为 Node 编写了一个 package 供本地使用,并使用 NPM 链接使其可用于全局命令行使用。

Now I need to change the package, I can not find it on my drive but the package is still linked through NPM and usable.现在我需要更改 package,我在我的驱动器上找不到它,但 package 仍然通过 NPM 链接并且可用。

Can NPM give me the path for linked modules? NPM 可以给我链接模块的路径吗?

As NPM uses symlinks, you can always see them with ls -l command in the console. 由于NPM使用符号链接,因此您始终可以在控制台中使用ls -l命令查看它们。

See details in the npm-link docs . 请参阅npm-link docs中的详细信息。

As someone mentioned above, The location of the Node.js files depends on the method you used to install it.正如上面有人提到的,Node.js 文件的位置取决于您用来安装它的方法。 I had the same issue and fixed it by locating the node_modules folder on my system and directly deleting the links.我有同样的问题并通过在我的系统上找到node_modules文件夹并直接删除链接来修复它。

If you downloaded and run, the installer package from the nodejs.org website, the Node.js main executables files -- node and npm -- are located on the /usr/local/bin folder.如果您从 nodejs.org 网站下载并运行安装程序 package,则 Node.js 主要可执行文件-- node and npm --位于/usr/local/bin文件夹中。

Note that I am on MacOS, not sure about Windows though.请注意,我使用的是 MacOS,但不确定 Windows。

Here's a link for more information and reference: https://davescripts.com/location-of-nodejs-files-on-mac-os-x#:~:text=If%20you%20downloaded%20and%20run,usr%2Flocal%2Fbin%20folder .以下是更多信息和参考的链接: https://davescripts.com/location-of-nodejs-files-on-mac-os-x#:~:text=If%20you%20downloaded%20and%20run,usr%2Flocal %2Fbin%20文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM