Node update a specific package

后端 未结 3 968
清酒与你
清酒与你 2020-12-12 11:05

I want to update my Browser-sync without updating all my node packages. How can I achieve this? My current version of Browser-sync does not have the Browser

3条回答
  •  没有蜡笔的小新
    2020-12-12 11:28

    Always you can do it manually. Those are the steps:

    • Go to the NPM package page, and search for the GitHub link.
    • Now download the latest version using GitHub download link, or by clonning. git clone github_url
    • Copy the package to your node_modules folder for e.g. node_modules/browser-sync

    Now it should work for you. To be sure it will not break in the future when you do npm i, continue the upcoming two steps:

    • Check the version of the new package by reading the package.json file in it's folder.
    • Open your project package.json and set the same version for where it's appear in the dependencies part of your package.json

    While it's not recommened to do it manually. Sometimes it's good to understand how things are working under the hood, to be able to fix things. I found myself doing it from time to time.

提交回复
热议问题