Install only one package from package.json?

As @atalantus noted in comment, the accepted answer doesn’t work on newer version of NPM. Working solution for newer versions (verified on NPM 6.13.4) is: npm install –no-package-lock –no-save [email protected] This will install bower and all its dependencies, but prevents installation of anything else you might have in package.json. It also doesn’t create or modify … Read more

Running http-server in background from an npm script

You can run a process in background by appending & in the end. And then use the postscript hook that npm offers us, in order to kill the background process. “scripts”: { “web-server”: “http-server -p 7777 httpdocs &”, “pretest”: “gulp build-httpdocs && npm run web-server”, “test”: “mocha spec.js”, “posttest”: “pkill -f http-server” } But what … Read more

what is the use of watchman for react native?

React Native uses watchman to detect when you’ve made code changes and then automatically build and push the update to your device without you needing to manually refresh it. https://facebook.github.io/watchman/ is the home page for the watchman used by React Native. Note that it is different and completely unrelated to https://www.npmjs.com/package/watchman which has some similar … Read more

How to update npm modules, ignoring a git repo

npm checks all directories for the existance of a .git directory, and throws the EISGIT error if it exists, so there is no way to ignore it or skip it. The code does however check if it’s a link: mod.parent && !mod.isLink && [checkGit, mod.realpath], So I was able to make it work by symlinking … Read more

NPM run parallel task, but wait until resource is available to run second task

You can try concurrently with wait-on package in order to manage conccurent/sequential scripts and outputs. wait-on sequential launches support head response status, tcp listening, … For example : “scripts”: { “start”: “concurrently -k -n \”DB,API,WEB\” -c \”blue,magenta,yellow\” \”npm run start-db\” \”npm run start-api\” \”npm run start-web\””, “start-db”: “myDbServerCmd”, “start-api”: “wait-on tcp:27017 && myApiServerCmd”, “start-web”: “myFrontServerCmd”, … Read more

Package.json with multiple entrypoints

As you’re using ECMAScript modules, please refer to node.js docs on package entry points: In a package’s package.json file, two fields can define entry points for a package: “main” and “exports”. The “main” field is supported in all versions of Node.js, but its capabilities are limited: it only defines the main entry point of the … Read more