I have a npm package (npm v 5.5.1 and node version is 9.2.0). If i run npm install on local machine then the postinstall defined in package.json is exe
npm install
postinstall
Try running install with --unsafe-perm option. When running as root, npm won't run any scripts.
--unsafe-perm
Alternatively, create a user in the Dockerfile and switch to that user:
FROM ... RUN groupadd -r app && useradd -r -g app app USER app