且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何编辑通过npm安装的节点模块?

更新时间:2022-06-21 23:08:59

您可以直接编辑该文件,但是每当npm更新时,该文件就会被覆盖,***的做法是直接访问源代码.

You can edit the file directly, but this would be overwritten whenever npm updates, the best thing to do is go straight to the source.

如果更改影响整个模块的功能,并且可能对其他模块有用,那么您可能希望对github上的原始源代码有所贡献,并寻找要实施的更改.

If the changes affect functionality of the overall module, and may be useful to others, you may want to contribute to the original source on github and look for the change to be implemented.

如果这是必需的专有功能,并且对模块的开发无济于事,那么***的办法是从github派生它并进行更改.您可以使用NPM直接从github安装项目,这种方法可以让您将将来的更改从原始来源集成到您的自定义版本中.

If this is proprietary functionality that is needed, and would not help the development of the module, the best thing to do is fork it from github and make your changes. You can install items directly from github using NPM, and this method would let you integrate future changes in to your custom version from the original source.

要直接从github安装,请使用以下命令:

To install directly from github, use the following command:

npm install https://github.com/<username>/<repository>/tarball/master