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

NPM run * doesn’t do anything

npm has a ignore-scripts configuration key. It’s expected value is a Boolean and it’s set to false by default. Perhaps it has inadvertently been set to true. To get/set the ignore-scripts configuration you can utilize the npm-config command: Check its current setting by running: npm config get ignore-scripts If the aforementioned command returns true then … Read more