avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 147 forks source link

Error installing on manjaro #435

Open mrkaspa opened 6 years ago

mrkaspa commented 6 years ago

I've tried to install this on manjaro with the cmd npm install -g elm-format

npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
/usr/bin/elm-format -> /usr/lib/node_modules/elm-format/bin/elm-format

> elm-format@0.6.1-alpha install /usr/lib/node_modules/elm-format
> binwrap-install

fs.js:663
  return binding.open(pathModule.toNamespacedPath(path),
                 ^

Error: EACCES: permission denied, open 'bin/elm-format'
    at Object.fs.openSync (fs.js:663:18)
    at Object.fs.writeFileSync (fs.js:1314:33)
    at /usr/lib/node_modules/elm-format/node_modules/binwrap/install.js:17:8
    at Array.forEach (<anonymous>)
    at install (/usr/lib/node_modules/elm-format/node_modules/binwrap/install.js:15:19)
    at Object.install (/usr/lib/node_modules/elm-format/node_modules/binwrap/index.js:8:14)
    at Object.<anonymous> (/usr/lib/node_modules/elm-format/node_modules/binwrap/bin/binwrap-install:16:9)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:613:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm-format@0.6.1-alpha install: `binwrap-install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the elm-format@0.6.1-alpha install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
avh4 commented 6 years ago

I think this is the same as https://github.com/avh4/elm-format/issues/377

The fix is to make https://github.com/avh4/binwrap handle the permissions properly.

The workaround is to install the binaries manually (or see the other issue for other suggestions).

lo-co commented 6 years ago

Can you expand on this? I don't see any suggestions in #377 other than use --loglevel=verbose which doesn't seem to be a real solution (and has more to do with hanging at binwrap than the above error). How do you install the binaries manually (what binaries does this refer to)?

lo-co commented 6 years ago

Regarding the permissions, you can install using

sudo npm install -g --unsafe-perm elm-format
avh4 commented 6 years ago

The real issue here is that binwrap doesn't correctly support installation in folders that aren't fully owned by the user. Fixing that would involve some development work and a PR to binwrap.

The workaround mentioned is to download the binaries from https://github.com/avh4/elm-format/releases and manually put them in the correct place on your path.