- Node.js Web Development
- David Herron
- 313字
- 2021-06-25 21:54:07
Fixing bugs by updating package dependencies
Bugs exist in every piece of software. An update to the Node.js platform may break an existing package, as might an upgrade to packages used by the application. Your application may trigger a bug in a package it uses. In these and other cases, fixing the problem might be as simple as updating a package dependency to a later (or earlier) version.
First identify whether the problem exists in the package or in your code. After determining it's a problem in another package, investigate whether the package maintainers have already fixed the bug. Is the package hosted on GitHub or another service with a public issue queue? Look for an open issue on this problem. That investigation will tell you whether to update the package dependency to a later version. Sometimes, it will tell you to revert to an earlier version; for example, if the package maintainer introduced a bug that doesn't exist in an earlier version.
Sometimes, you will find that the package maintainers are unprepared to issue a new release. In such a case, you can fork their repository and create a patched version of their package.
One approach to fixing this problem is pinning the package version number to one that's known to work. You might know that version 6.1.2 was the last release against which your application functioned, and that starting with version 6.2.0 your application breaks. Hence, in package.json:
"dependencies": {
"module1": "6.1.2"
}
This freezes your dependency to the specific version number. You're free, then, to take your time updating your code to work against later releases of that module. Once your code is updated, or the upstream project is updated, change the dependency appropriately.
Another approach is to host a version of the package somewhere outside of the npm repository. This is covered in a later section.
- Python數(shù)據(jù)分析入門與實(shí)戰(zhàn)
- Monkey Game Development:Beginner's Guide
- PostgreSQL Replication(Second Edition)
- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- Spring Boot Cookbook
- Android系統(tǒng)級(jí)深入開發(fā)
- Building Serverless Web Applications
- RESTful Web Clients:基于超媒體的可復(fù)用客戶端
- TypeScript 2.x By Example
- 分布式架構(gòu)原理與實(shí)踐
- H5+移動(dòng)營(yíng)銷設(shè)計(jì)寶典
- Beginning C# 7 Hands-On:The Core Language
- Java核心編程
- Getting Started with Web Components
- Extending Docker