英文:
Is it possible to specify a npm module version without updating package.json?
问题
I would like to override a npm module's version without changing the package.json
file as I would like to avoid forking the repo, if possible.
If the package.json
file looks something like
...
"dependencies": {
"iwanttooverridethis": "2.5.0",
...
can I run a step like npm install --override "iwanttooverridethis=3.0.0"
which would install version 3.0.0 of iwanttooverridethis
instead of version 2.5.0? Or achieve the same result some other way?
英文:
I would like to override a npm module's version without changing the package.json
file as I would like to avoid forking the repo, if possible.
If the package.json
file looks something like
...
"dependencies": {
"iwanttooverridethis": "2.5.0",
...
can I run a step like npm install --override "iwanttooverridethis=3.0.0"
which would install version 3.0.0 of iwanttooverridethis
instead of version 2.5.0? Or achieve the same result some other way?
答案1
得分: 0
你可以使用 --no-save
标志来安装指定的 npm 包版本,而不更改 package.json
文件。请记住,这是临时的,当你运行 npm install
时,它将重置为 package.json
文件中指定的版本。示例:npm install yourpackage@3.0.0 --no-save
。
英文:
You should be able to use the --no-save
flag to install the specified npm package version without changing the package.json
file. Just keep in mind that this is temporary and will reset to the one specified in the package.json
file when you run npm install
. An example is npm install yourpackage@3.0.0 --no-save
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论