Running npm Scripts Containing Bash On Windows

You may at some point find yourself using a Windows machine and needing to run an npm script that uses Bash. Typically, this would cause instant errors. Fortunately, though, there is a simple solution to this dilemma. Here’s an example of an npm script that will fail on Windows: { "name": “something”, "version": "0.0.0", "license": "MIT", "scripts": { “show-directory-contents”: “ls -a -t” }, … In order to run npm scripts like this, we need to do two simple things. »