npm package.json OS specific script

There’s an NPM package called run-script-os ( NPM | GitHub ) that doesn’t require you to write any additional files, and this can be convenient if what you’re trying to do is very simple. For example, in your package.json, you might have something like: “scripts”: { “test”: “run-script-os”, “test:darwin:linux”: “export NODE_ENV=test && mocha”, “test:win32”: “SET … Read more

How can I reference package version in npm script?

1) Referencing package version in npm-scripts. In npm-script‘s you can reference the version using the variable npm_package_version. For example: Using a bash shell (E.g. Linux, macOS): { … “version”: “1.0.0”, “scripts”: { “build”: “echo $npm_package_version” } } Note the $ prefix Using Windows (E.g. cmd.exe, Powershell): { … “version”: “1.0.0”, “scripts”: { “build”: “echo %npm_package_version%” … Read more

Start script missing error when running npm start

It looks like you might not have defined a start script in your package.json file or your project does not contain a server.js file. If there is a server.js file in the root of your package, then npm will default the start command to node server.js. https://docs.npmjs.com/misc/scripts#default-values You could either change the name of your … Read more