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

What is the difference between “npm install” and “npm ci”?

From the npm docs: In short, the main differences between using npm install and npm ci are: The project must have an existing package-lock.json or npm-shrinkwrap.json. If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock. npm ci can only … Read more

Pass command line args to npm scripts in package.json

Short Answer: Essentially, what you’re wanting is to have an npm-script something like this, whereby <arg-here> is provide via the CLI; … “scripts”: { “my-build”: “npm run vumper <arg-here> && npm run format”, … }, … However, unfortunately npm does not have a built-in feature to achieve this. The special npm option –, (refer to … Read more

tech