When you run the script directly through node run.js process.stdout.columns works fine and returns the number of valid characters. When you run the script through a command created in package.json, npm run build , which runs essentially the same node run.js , process.stdout.columns returns undefined .
How to fix this and, most importantly, I want to know why this is happening?
npmor directly fromnode index.jsand if npm runs the npm commandnode -v v6.3.1- Vasily Barbashev