想要 package.json 依赖特定的 npm 版本,并安装它?
Want package.json to depend on specific npm version, and install it?
我希望 package.json 依赖于特定的 npm 版本,并安装它。我看到有一个 NVM,但不知道这是否满足了我的需要。如果 npm 在某处不符合指定版本,我至少会想要一个错误。
您可以在 package.json
的 engines
字段中为您的模块指定所需的 npm
版本:
{
"name": "moduleName",
"engines": {
"npm": "~2.4.12"
}
}
如 npm package.json doc, this config is advisory - unless the user sets the engine-strict
配置标志中所指定。
我希望 package.json 依赖于特定的 npm 版本,并安装它。我看到有一个 NVM,但不知道这是否满足了我的需要。如果 npm 在某处不符合指定版本,我至少会想要一个错误。
您可以在 package.json
的 engines
字段中为您的模块指定所需的 npm
版本:
{
"name": "moduleName",
"engines": {
"npm": "~2.4.12"
}
}
如 npm package.json doc, this config is advisory - unless the user sets the engine-strict
配置标志中所指定。