I am deploying a private npm module for internal use at our company. Since the module is handled internally, we can trust version bumps etc.
我正在部署一个私有的npm模块供公司内部使用。由于模块是在内部处理的,所以我们可以信任版本冲突等等。
How can I install the module in various projects so that the latest version of the module will always be installed with every single npm install
, so that I don't have to go through a bunch of projects and update the version inside each package.json
every time we deploy?
我如何在不同的项目中安装模块,这样模块的最新版本就会一直安装在每一个npm安装中,这样我就不必经历一堆项目,并在每个包内更新版本。每次部署json ?
Please note that this should only be for selected packages, not all packages - i.e. only those hosted on our private server.
请注意,这应该只针对选定的包,而不是所有的包——例如,只针对托管在我们的私有服务器上的包。
3 个解决方案
#1
2
Use "*" as your version in your package.json file. For example:
在包中使用“*”作为您的版本。json文件。例如:
"dependencies": {
"my-awesome-repo": "*"
}
Upon npm install
this will automatically install the latest version for "my-awesome-repo" that is availabile on npm.
在npm安装时,它将自动安装npm上可用的最新版本“my-awesome-repo”。
#2
1
One way is to run this before each install.
一种方法是在每次安装之前运行它。
npm i -g npm-check-updates
npm-check-updates -u
npm install
On npm < 3.11:
在npm < 3.11:
"dependencies": {
"express": "~3.2.0",
"mongodb": "~1.2.14",
"underscore": "~1.4.4",
"rjs": "~2.10.0",
"jade": "~0.29.0",
"async": "~0.2.7"
}
#3
0
You could try using the following package, which allows version selection by dist tag rather than a semantic version (e.g. latest
).
您可以尝试使用以下包,它允许通过dist标记而不是语义版本(例如最新的)选择版本。
https://www.npmjs.com/package/package-json
https://www.npmjs.com/package/package-json
#1
2
Use "*" as your version in your package.json file. For example:
在包中使用“*”作为您的版本。json文件。例如:
"dependencies": {
"my-awesome-repo": "*"
}
Upon npm install
this will automatically install the latest version for "my-awesome-repo" that is availabile on npm.
在npm安装时,它将自动安装npm上可用的最新版本“my-awesome-repo”。
#2
1
One way is to run this before each install.
一种方法是在每次安装之前运行它。
npm i -g npm-check-updates
npm-check-updates -u
npm install
On npm < 3.11:
在npm < 3.11:
"dependencies": {
"express": "~3.2.0",
"mongodb": "~1.2.14",
"underscore": "~1.4.4",
"rjs": "~2.10.0",
"jade": "~0.29.0",
"async": "~0.2.7"
}
#3
0
You could try using the following package, which allows version selection by dist tag rather than a semantic version (e.g. latest
).
您可以尝试使用以下包,它允许通过dist标记而不是语义版本(例如最新的)选择版本。
https://www.npmjs.com/package/package-json
https://www.npmjs.com/package/package-json