How to fix SSL certificate error when running Npm on Windows?

TL;DR – Just run this and don’t disable your security: Replace existing certs # Windows/MacOS/Linux npm config set cafile “<path to your certificate file>” # Check the ‘cafile’ npm config get cafile or extend existing certs Set this environment variable to extend pre-defined certs: NODE_EXTRA_CA_CERTS to “<path to certificate file>” Full story I’ve had to … Read more

how to install multiple versions of package using npm

As of npm v6.9.0, npm now supports package aliases. It implements the same syntax as Yarn uses: npm install jquery2@npm:jquery@2 npm install jquery3@npm:jquery@3 This adds the following to package.json: “dependencies”: { “jquery2”: “npm:jquery@^2.2.4”, “jquery3”: “npm:jquery@^3.4.1” } It is also possible to install directly from GitHub with this syntax. For example, if you want to install … Read more

What is the role of the package-lock.json?

It stores an exact, versioned dependency tree rather than using starred versioning like package.json itself (e.g. 1.0.*). This means you can guarantee the dependencies for other developers or prod releases, etc. It also has a mechanism to lock the tree but generally will regenerate if package.json changes. From the npm docs: package-lock.json is automatically generated … Read more