strongloop / modern-syslog

modern-syslog
Other
49 stars 19 forks source link

EACCES: permission denied #38

Closed scalp42 closed 4 years ago

scalp42 commented 4 years ago

Hi @sam-github,

We keep seeing the following issue:

       Recipe: statsd::configure
         * execute[install npm module statsd-instrumental-backend] action run[2019-05-28T02:07:20+00:00] INFO: Processing execute[install npm module statsd-instrumental-backend] action run (statsd::configure line 39)

           [execute]
              > modern-syslog@1.1.2 install /usr/share/statsd/node_modules/modern-syslog
              > node-gyp rebuild

              gyp ERR! configure error
              gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/share/statsd/node_modules/modern-syslog/build'
              gyp ERR! System Linux 4.15.0-29-generic
              gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
              gyp ERR! cwd /usr/share/statsd/node_modules/modern-syslog
              gyp ERR! node -v v10.15.3
              gyp ERR! node-gyp -v v3.8.0
              gyp ERR! not ok
              npm WARN optional SKIPPING OPTIONAL DEPENDENCY: modern-syslog@1.1.2 (node_modules/modern-syslog):
              npm WARN optional SKIPPING OPTIONAL DEPENDENCY: modern-syslog@1.1.2 install: `node-gyp rebuild`
              npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

              + statsd-instrumental-backend@0.13.1
              updated 1 package and audited 865 packages in 2.426s
              found 46 vulnerabilities (21 low, 23 moderate, 2 high)
                run `npm audit fix` to fix them, or `npm audit` for details

Curious you had any idea?

Thanks in advance!

sam-github commented 4 years ago

I suspect you are npm installing something as the root user, is that the case?

If so, probably don't, or use https://docs.npmjs.com/misc/config#unsafe-perm, or don't install to a location that needs root perms.

modern-syslog needs to be built, so it needs to write to the fs, and npm when run as root drops its root privileges. root privs are usually needed to write to /usr/share.

scalp42 commented 4 years ago

Thanks for the quick answer @sam-github much appreciated.

sam-github commented 4 years ago

@scalp42 you may find this interesting: https://github.com/npm/pacote/commit/d2f4176b6af393d7e29de27e9b638dbcbab9a0c7 from the latest npm release, it might help with this situation