elm-version-manager
elm-version-manager copied to clipboard
/usr/local/bin requires root access
I'm using EVM on a Debian Stretch machine and when I try to activate a elm version, it gives me errors related with access permission, because it doesn't have access to the /usr/local/bin folder:
$ evm use 0.17.1
Using: 0.17.1 0
0
fs.js:953 0
return binding.symlink(preprocessSymlinkDestination(target, type, path),
^ 0
Error: EACCES: permission denied, symlink '/home/david/evm/0.17.1/elm' -> '/usr/local/bin/elm'
at Object.fs.symlinkSync (fs.js:953:18)
at /opt/node/lib/node_modules/elm-version-manager/index.js:111:14
at FSReqWrap.oncomplete (fs.js:111:15)
Using the same command with sudo didn't solve the issue:
$ sudo evm use 0.17.1
fs.js:862
return binding.readdir(pathModule._makeLong(path), options.encoding);
^
Error: ENOENT: no such file or directory, scandir '/root/evm'
at Object.fs.readdirSync (fs.js:862:18)
at isVersionInstall (/opt/node/lib/node_modules/elm-version-manager/index.js:77:13)
at Command.use (/opt/node/lib/node_modules/elm-version-manager/index.js:98:7)
at Command.listener (/opt/node/lib/node_modules/elm-version-manager/node_modules/commander/index.js:301:8)
at emitTwo (events.js:106:13)
at Command.emit (events.js:191:7)
at Command.parseArgs (/opt/node/lib/node_modules/elm-version-manager/node_modules/commander/index.js:615:12)
at Command.parse (/opt/node/lib/node_modules/elm-version-manager/node_modules/commander/index.js:458:21)
at Object.<anonymous> (/opt/node/lib/node_modules/elm-version-manager/index.js:258:9)
at Module._compile (module.js:573:32)
I found a workaround that was manually linking the /usr/local/bin elm binaries to a folder inside the evm folder called "active" and then, I modified this line https://github.com/mattludwigs/elm-version-manager/blob/master/index.js#L33 to be the next:
var usrBin = EVM_DIR + "/active";
As that folder is inside the user reign, it has access and everything seems to work fine.
I don't know how common my issue will be, but to be able to configure usrBin without the need of hacking the index.js could be a solution for similar issues to this.
Thank you @DavidHernandez for the issue. I think the solution to: https://github.com/mattludwigs/elm-version-manager/issues/5 should fix this issue. I am hoping to get around to fixing that issue this coming week.
@mattludwigs thank you for the answer. I will subscribe to the other issue and test if this is still a problem after #5 is fixed.
@DavidHernandez that would be awesome! One of the biggest challenges I am going to face is the all the different systems out there and trying to account for them correctly, so the more diverse the systems trying to use this, better and more reliable we can make it. So by doing a test on your system is a huge help!
@mattludwigs I'm usually online on european office hours in the elm slack and IRC, using david_hernandez as nickname . So feel free to ping me if you need some testing in my system for this or a different issue.
simon@simon-desktop:~/code/sync/Elm/elm-diagrams$ evm use 0.16.0
Using: 0.16.0
fs.js:1021
return binding.symlink(preprocessSymlinkDestination(target, type, path),
^
Error: EACCES: permission denied, symlink '/home/simon/evm/0.16.0/elm' -> '/usr/local/bin/elm'
at Object.fs.symlinkSync (fs.js:1021:18)
at /home/simon/.npm-global/lib/node_modules/elm-version-manager/index.js:111:14
at FSReqWrap.oncomplete (fs.js:136:15)
I'm seeing the same error with a setup based on https://docs.npmjs.com/getting-started/fixing-npm-permissions. And using sudo (Ubuntu) does not help because then the node libraries I install as user are not available.