Permission denied, mkdir '/usr/src/www'


#1

I have an ionic app as a sub folder and added a package.json to my root folder containing

{
    "scripts": {
        "install": "cd path-to/your-app && npm install",
        "build": "cd path-to/your-app && ./node_modules/.bin/ionic-app-scripts build --prod --wwwDir ./../../www"
    }
}

as described by the documentation here https://ionicframework.com/docs/pro/basics/concepts/customizing-builds.html

The automatic build however fails during the build step with the following error

Error: EACCES: permission denied, mkdir ‘/usr/src/www’
Error: EACCES: permission denied, mkdir ‘/usr/src/www’
npm info lifecycle BlueChameleon.TradenShare@~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! BlueChameleon.TradenShare@ build: cd BlueChameleon.TradenShare.App && ./node_modules/.bin/ionic-app-scripts build --prod --wwwDir ./../../www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the BlueChameleon.TradenShare@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

Obviously this is a permission error, but how do I get around this on the automatic build in ionic?