app.js (root is not file owner)
var fs = require('fs');
fs.mkdirSync('/root/tmp');
package.json
{
"scripts": {
"app": "node app.js"
}
}
When I run as root npm run app I got
> app
> node app.js
node:internal/fs/utils:344
throw err;
^
Error: EACCES: permission denied, mkdir '/root/tmp'
But it works when I run just node app.js. Which setting/option of npm can help me run npm run app without errors?
Why npm run change user? How to force npm not to change user?