There is a permission error when running postinstall script in Docker

Your environment

  • Operating system: Ubuntu 21.04
  • Node version: 14.17
  • Docker version: 20.10.9, build c2ea9bc
  • Docker base image: node:14.17-alpine3.14
  • gcc/clang version: 10.3.1_git20210424-r2
  • mediasoup version: 3.8.4

Issue description

When I’m building my project with Docker there is a permission error in postinstall script. This is the error:

> mediasoup@3.8.4 postinstall /usr/src/app/node_modules/mediasoup
> node npm-scripts.js postinstall

npm-scripts.js [INFO] running task "postinstall"
npm-scripts.js [INFO] executing command: make -C worker
make: dirname: Operation not permitted
make: Entering directory '/usr/src/app/node_modules/mediasoup/worker'
make: /bin/sh: Operation not permitted
make: /bin/sh: Operation not permitted
./scripts/configure.py -R mediasoup-worker
make: ./scripts/configure.py: Operation not permitted
make: *** [Makefile:24: default] Error 127
make: Leaving directory '/usr/src/app/node_modules/mediasoup/worker'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.8.4 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mediasoup@3.8.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-10-10T05_19_47_420Z-debug.log

Can you attach Dockerfile for reference, like reproducible test case?

Removing the “npm install” from dockerfile and doing it manually from inside the container using “docker exec xxx -it /bin/sh” will allow u to debug it.

1 Like