有没有办法从命令行告诉 npm 使用与“package.json”不同的文件?
编辑:
感谢您的回答。我已经检查了文档并希望有一种解决方法或一种未记录的方法来实现这一点。那我再想想别的办法。
最佳答案
仅使用客户端空间工具,这似乎很简单,但您做不到。 npm doc 对此持肯定态度:
A package is:
a) a folder containing a program described by a package.json file
b) a gzipped tarball containing (a)
c) a url thatresolves to (b)
d) a <name>@<version> that is published on theregistry with (c)
e) a <name>@<tag> that points to (d)
f) a <name>that has a "latest" tag satisfying (e)
g) a git url that, when cloned,results in (a).
[...]
You need to have a package.json file in the root of your project to do much of anything with npm. That is basically the whole interface.
如您所见,他们非常清楚 package.json
是任何工作所必需的。
您必须深入研究代码,才能获得不可重用的结果。如果这是您想要的,请在您的问题中明确说明,以便其他人理解为什么有必要这样做。
关于node.js - 为 npm 使用不同于 "package.json"的文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25991082/