How to run iex as normal user? - erlang

I'm following this link to install elixir and erlang on fedora 21... After i installed when i tried to run interactive elixir(iex) i get the following error
/home/hari/.asdf/installs/elixir/1.4.2/bin/elixir: line 126: exec: erl: not found
Commands i used to install :
asdf install erlang 19.0
asdf install elixir 1.3.2
But if i run as a root user its working correctly!!! What's the mistake im commiting here?

It’s a path issue. Please do the following to detect the problem root:
sudo su -c 'which erl'
#⇒ /usr/local/bin/erl # OR LIKE
It seems that this directory is not on your user’s path. Add it to test:
export PATH=`dirname $(sudo su -c 'which erl')`:$PATH
Try running elixir (it should succeed.) Now just put the hardcoded path in the very end of your shell start script (~/.bashrc if you use bash, etc):
export PATH=/usr/local/bin:$PATH

Related

Lumber: Command 'lumber' not found

I just setup a Rails Application in my Ubuntu 18 machine, and I want to connect it to Forest Admin. However, Forest Admin requires that I set up a Node Application using npm first. The node application requires the installation of Lumber CLI tool in order to install Forest Admin.
I have however installed Lumber CLI tool by running the command below:
npm install -g lumber-cli#latest -s
When I run the command below npm lumber -version in my command line terminal, I get the response:
6.13.4
But when I try to generate the Forest Admin using the command below:
lumber generate "my_project"...
I get the following error:
Command 'lumber' not found
I need some help. Thank you.
Here's how I solved it:
The issue is because NPM does not have the write access to the directory that will contain the package you want to install (here lumber-cli).
To solve this issue, override the default directory where your global NPM packages will be stored:
mkdir ~/.npm-global
Then, configure NPM to use this directory instead of the default one:
npm config set prefix '~/.npm-global'
Then, make the node executables accessible from your PATH. To do so, export the environment variable PATH by opening or creating the file ~/.profile and add this line at the end:
export PATH=~/.npm-global/bin:$PATH
Finally, reload the ~/.profile file:
source ~/.profile
Try installing lumber cli again using the command below:
npm install -g lumber-cli#latest -s
It should be able to install lumber without any error, and also display the directory where lumber-cli is installed.
Reference: Prevent permission errors at installation
That's all
I hope this helps

Error when installing bazel on windows

I am trying to install Bazel (version 0.10.0) on windows 7, but i have a problem when i try to excute compile.sh.
c.kazdghli#cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe
c.kazdghli#cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export BAZEL_VS=c:/Program\ Files\ \(x86\)/Microsoft\ visual\ studio
c.kazdghli#cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export BAZEL_PYTHON=c:/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36/python.exe
c.kazdghli#cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ ./compile.sh
ERROR: cannot locate python.exe; check your PATH.
You may need to run the following command, or something
similar, depending on where you installed Python:
export PATH="/c/Python27:$PATH"
c.kazdghli#cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ export PATH=/c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36:$PATH
c.kazdghli#cKAZDGHL-STG-PC MINGW64 /c/Users/c.kazdghli/Downloads/bazel-0.10.0
$ ./compile.sh
ERROR: cannot locate python.exe; check your PATH.
You may need to run the following command, or something
similar, depending on where you installed Python:
export PATH="/c/Python27:$PATH"
Run which python.exe after you export the new PATH and make sure the result is /c/Users/c.kazdaghli/AppData/Local/Programs/Python/Python36/python.exe.
Keep in mind that which operates by looking up the file in directories on the PATH, i.e. the PATH must contain the path to the directory where python.exe is, not the path of python.exe itself.
This problem can be easily solved by the installing bazel from Chocolatey
Install Chocolatey with cmd.exe:
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Then use the following command in cmd to install bazel:
choco install bazel --pre

sudo luarocks command not found on centos7

I installed luarocks on centos7, then I execute 'luarocks install luacheck', there is an error:
'Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks
-- you may want to run as a privileged user or use your local tree with --local.'
So, I execute 'sudo luarocks install luacheck', but there is also an error:
'sudo luarocks command not found'.
I confirm that luarocks has installed correctly, bucause when I execte 'luarocks --version' shows:
/usr/bin/luarocks 2.4.2
As luarocks isn't installed using the native package manager its installed to /usr/local/bin. This isn't in the PATH variable available in the sudo context - you can see (and edit) the configured paths in the secure_path property in the sudoers file.
Workaround that I use it to add a symbolic link to a path included in the secure_path property: sudo ln -s /usr/local/bin/luarocks /usr/bin/luarocks
You can either use
sudo /usr/bin/luarocks install luacheck
to install luacheck system-wide
or
luarocks --local install luacheck
to install to your user only. To use the second option, you also need to run
eval $(luarocks path --bin)
to make sure that the Lua paths are updated in your shell. To make these Lua paths permanent, you can add the above line to your shell config file (~/.bash_profile or similar).

Could not login with bash shell by default

I want to run a Ruby on Rails application. When I tried to run it, it shows me this,
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
So, I figured out the problem and I found that the problem is due to not login into bash shell. My terminal could not execute 'ruby' or 'ruby on rails' scripts. I checked .bashrc and .bash_profile files if PATH variable is set to point to rvm file.
When I did,
/bash/bin -l
it shows me ruby or rails are installed on system and I could start Rails server successfully. But if I opened another Terminal window, same problem occurs. Basically, I want to log into bash shell by default. Please correct and help me to sort out this. Thanks!
If you are sure the location of your bash shell is /bin/bash you could use this command (replacing "username" with your username):
chsh -s /bin/bash username
That will change your default shell in most unix like operating systems.
Afterwards you can verify it checking /etc/passwd where you will see the default shell at the end of the line of your username.
Warning: Try it first with a new user, in order to avoid losing your shell access if the path to bash is different :-)

Portable erlang

Is there a recommended way to "bootstrap" an Erlang distribution? I would like to run erlang on the bunch of machines where I do not have root elevation nor development tool-set (no compilers etc ...) . My thinking was to pre-package (on the machine with the same architecture) as much as I can before. What are the minimal requirements for an usable Erlang environment?
You can use the different erlware tools. Using the latest Sinan, you can even create a standalone release with the erts bundled.
Ok, I should have read it before ... (from INSTALL.md)
* Install using the `release` target. Instead of doing `make install` you
can create the installation in whatever directory you like using the
`release` target and run the `Install` script yourself. `RELEASE_ROOT`
is used for specifying the directory where the installation should be
created. This is what by default ends up under `/usr/local/lib/erlang`
if you do the install using `make install`. All installation paths
provided in the `configure` phase are ignored, as well as `DESTDIR`,
and `INSTALL_PREFIX`. If you want links from a specific `bin` directory
to the installation you have to set those up yourself. An example where
Erlang/OTP should be located at `/home/me/OTP`:
$ ./configure
$ make
$ make RELEASE_ROOT=/home/me/OTP release
$ cd /home/me/OTP
$ ./Install -minimal /home/me/OTP
$ mkdir -p /home/me/bin
$ cd /home/me/bin
$ ln -s /home/me/OTP/bin/erl erl
$ ln -s /home/me/OTP/bin/erlc erlc
$ ln -s /home/me/OTP/bin/escript escript
You can look at Wing3D for example.
CouchDB is another example. (Credit to tbikeev.)

Resources