使用编写的package.json加载依赖项的npm安装
我注意到,在查看使用编写的package.json加载依赖项的npm安装,json,node.js,npm,package,Json,Node.js,Npm,Package,我注意到,在查看节点_modules下的package.json时,我看到的json看起来像: { "_args": [ [ "example@0.2.0", "C:\\path\\to\\project\\folder" ] ], "_from": "example@0.2.0", "_id": "example@0.2.0", "_inCache": true, "_installable": true, "_locatio
节点_modules
下的package.json
时,我看到的json看起来像:
{
"_args": [
[
"example@0.2.0",
"C:\\path\\to\\project\\folder"
]
],
"_from": "example@0.2.0",
"_id": "example@0.2.0",
"_inCache": true,
"_installable": true,
"_location": "/example",
"_nodeVersion": "6.2.0",
"_npmUser": {},
"_npmVersion": "3.8.9",
"_phantomChildren": {},
"_requested": {
"name": "example",
"raw": "example@0.2.0",
"rawSpec": "0.2.0",
"scope": "@edf",
"spec": "0.2.0",
"type": "version"
},
"_requiredBy": [
"/"
],
"_resolved": "http://internal.registry/example/-/example-0.2.0.tgz",
"_shasum": "b564b263db925ff3a8bffdc922c16f8e4b6f4641",
"_shrinkwrap": null,
"_spec": "example@0.2.0",
"_where": "C:\\path\\to\\project\\folder",
"author": {
"name": "NPM User"
},
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0"
},
"description": "Example Package",
"devDependencies": {},
"dist": {
"shasum": "b564b263db925ff3a8bffdc922c16f8e4b6f4641",
"tarball": "http://internal.registry/example/-/example-0.2.0.tgz"
},
"main": "index.js",
"name": "example",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"readmeFilename": "README.md",
"scripts": {
"postinstall": "gulp"
},
"version": "0.2.0"
}
而不仅仅是:
{
"name": "example",
"version": "0.2.0",
"description": "Example Package",
"main": "index.js",
"scripts": {
"postinstall": "gulp"
},
"author": "NPM User",
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0"
}
}
我是否可以指定一个命令行参数来保持安装时编写的依赖项package.json
文件,或者在没有为包指定存储库的情况下,是否有其他方法可以访问编写的文件
我在上找到了一个名为的选项,但我认为这不是我要找的。afaik,我认为您无法做到这一点,npm将在创建新版本时转换并保存程序包json文件。它不会保留原始的包文件。我怀疑,专有属性与tar处理有关,与npm本身无关。@如果发布包的新版本而不更新前缀属性,mh cbon会覆盖这些属性吗?我假设两个版本之间的值可能会发生变化。请注意,这些带下划线的值由npm控制,而不是由维护人员控制。另外请注意,您显示的是一个已安装包的值,我认为它与保存在npmregistry上的tarball中的值不同。对于不同的用户/操作系统等,它们将是不同的(请参阅第一个参数,这是windows路径)。如果这有帮助,您可能需要检查现有包的元数据,例如。@mh cbon谢谢!直接从注册表请求元数据将是一个合理的解决方案。如果你能把它作为一个答案,我会投赞成票并接受。