Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails as root #66

Open
kerrick-lyft opened this issue Dec 13, 2017 · 1 comment
Open

Install fails as root #66

kerrick-lyft opened this issue Dec 13, 2017 · 1 comment

Comments

@kerrick-lyft
Copy link

When git-validate is installed as a dependency of another package when running npm install as root, git-validate fails to install.

The specific error is:

fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/tmp/baz/openstreetmap/.git/hooks/pre-commit'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.writeFileSync (fs.js:1333:33)
    at Object.exports.installHooks (/tmp/baz/openstreetmap/node_modules/git-validate/lib/utils.js:248:12)
    at Object.<anonymous> (/tmp/baz/openstreetmap/node_modules/git-validate/bin/install.js:3:7)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

This does not happen if I run as a regular user, or if I directly git clone this repo and run npm install.

To reproduce this, you can run the following (as root):

git clone https://github.com/pelias/openstreetmap.git && cd openstreetmap && npm install

P.S. I noticed that /tmp/baz/openstreetmap/.git/hooks/pre-commit does not exist. If I touch it, I get a different error:

fs.js:809
  return binding.rename(pathModule._makeLong(oldPath),
                 ^

Error: EACCES: permission denied, rename '/tmp/baz/openstreetmap/.git/hooks/pre-commit' -> '/tmp/baz/openstreetmap/.git/hooks/pre-commit.backup'
    at Error (native)
    at Object.fs.renameSync (fs.js:809:18)
    at Object.exports.installHooks (/tmp/baz/openstreetmap/node_modules/git-validate/lib/utils.js:245:16)
    at Object.<anonymous> (/tmp/baz/openstreetmap/node_modules/git-validate/bin/install.js:3:7)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
pelias-openstreetmap@0.0.0-semantic-release /tmp/baz/openstreetmap
@daviddias
Copy link

daviddias commented Jul 13, 2018

We detected this as well for pre-push hooks - ipfs/aegir#251. Actually, slight different, the issue that we see is that it doesn't find the file.

Diagnosis of this one is still incomplete. I can't reproduce it 100% of the times anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants