Problem:
I'm attempting to create a Dockerfile that installs all the components to run Go, to install GVM (Go Version Management), and to install specific Go Versions.
Error:
When I try building the container with:
docker build -t ##### .
I get this error:
/bin/sh: 1: gvm: not found
The command '/bin/sh -c gvm install go1.4 -B' returned a non-zero code: 127
Installed here:
/root/.gvm/scripts/env/gvm
/root/.gvm/scripts/gvm
/root/.gvm/bin/gvm
What I tried:
It's clearly able to install GVM but unable to use it. Why?
I thought maybe I needed to refresh the .bashrc or the .bash_profile ... but that didn't work, since they don't exist.
Dockerfile:
FROM #####/#####
#Installing Golang dependencies
RUN apt-get -y install curl git mercurial make binutils bison gcc build-essential
#Installing Golang
RUN ["/bin/bash", "-c", "bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)"]
#gvm does not exist here... why?
RUN gvm install go1.4 -B
RUN gvm use go1.4
Question:
Why does GVM not seem to be installed? How do I get rid of the error?
Your shell is /bin/sh, but gvm puts its initialization in ~/.bashrc, and expects /bin/bash.
You need to source the gvm initialization scripts to run the commands from a non-interactive bash shell:
RUN ["/bin/bash", "-c", ". /root/.gvm/scripts/gvm && gvm install go1.4 -B"]
RUN ["/bin/bash", "-c", ". /root/.gvm/scripts/gvm && gvm use go1.4"]
Or even better might be to put the commands you want to execute in a single bash script and add that to the image.
#!/bin/bash
set -e
source /root/.gvm/scripts/gvm
gvm install go1.4
gvm use go1.4
Related
sudo go install github.com/KathanP19/Gxss#latest
sudo: go: command not found
I try to install tool with sudo command but it shows sudo: go: command not found....any solutions?
but i installed go
─(spark㉿usr)-[~]
└─$ go version 1 ⨯
go version go1.18.1 linux/amd64
echo $PATH
/home/spark/.cargo/bin:/home/spark/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin
sudo has its own $PATH which is defined by the secure_path setting in your sudo config.
To fix it:
Open your sudo config sudo visudo
Locate the line staring with Defaults secure_path =
Add :/usr/local/go/bin to the end of the line
After saving the config, you should be able to use go with sudo
I'm familiar with cmake, however I don't see a cmake file in the MODFLOW6 code. I thought I had brew installed, but my computer can't seem to find it. Any help getting MODFLOW6 compiled would be great!
Go to https://brew.sh/ and get the homebrew install command from there:
From the command-line run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Add it to the path with:
sudo echo "export PATH=\"/opt/homebrew/bin/:$PATH\"" >> ~/.zshrc
Load the homebrew path into your activate terminal
source ~/.zshrc
Install the meson build system and gfortran
brew install meson
brew install gfortran
brew install git
Acquire the code:
git clone https://github.com/MODFLOW-USGS/modflow6.git
Enter the directory:
cd modflow6
Make a build directory:
mkdir build
cd build
Build the makefiles:
meson ..
Compile the code:
ninja
The compiled code is now at:
modflow6/build/utils/mf5to6
You can even add this to your path with:
sudo echo 'export PATH="$HOME/modflow6/build/utils/mf5to6:$PATH"' >> ~/.zshrc
source ~/.zshrc
if you want to be able to run mf5to6 from anywhere.
Alternatively, you can run it from its location using:
./modflow6/build/utils/mf5to6
I'm running it on Ubuntu.
when I try to run: npm install -g jfrog-cli-go
I get:
And when I try the other option of running it using curl, it gives the feeling like it succeeded but when I try to run
> jfrog
it doesn't recognize the command curl -fL https://getcli.jfrog.io | sh
I get:
the jfrog-cli version that I'm using is: 1.17.1
Can anyone tell me what's the problem here?
npm:
For npm in Ubuntu please use --unsafe-perm=true flag:
sudo npm install -g jfrog-cli-go --unsafe-perm=true.
Please see the npm package documentation for more info.
curl: Curl will download jfrog cli to your current working directory. After this, you can either run it locally by running ./jfrog or moving it to Ubuntu's execution path, e.g. sudo mv ./jfrog /usr/local/bin/
After a thorough analysis of 'Could not execute command lessc' i've successfully ran odoo (any version) on my command line with python virtual env. Am doing this to run odoo in command line
$ . {PATH_TO_VIRTUAL_ENV}/bin/activate (Running the script in the current shell)
$ cd {PATH_TO_ODOO_SOURCE}
$ ./odoo.py -c setup.cfg
And the above runs with proper UI.
Now when trying to run the same from eclipse throws me 'Could not execute command lessc'. I did the below to run code from eclipse
Installed pydev plugin in eclipse Mars
Configured Python interpreter (Given the virtual env python path here. i.e {PATH_TO_VIRTUAL_ENV}/bin/python)
Setup odoo source
Specified the new python interpreter on the project properties -> python interpretor
Created a new Run Configuration to run the source with the custom setup file and with the new interpretor
Kindly throw me light on places where i miss. Also i've gone through links on setting up python virtual env in eclipse. They all say the same thing still this lessc dependency is somehow not linked. Please comment if you require more info to identify the error. Thanks for your help! :)
FYI am using mac.
Update
For Shikhar (based on his answer)
This problem is related to your bad configuration of Nodejs and less on system.
Use commands below to resolve this -
wget -qO- https://deb.nodesource.com/setup | sudo bash -
then
brew install node
and finally
sudo npm install -g less less-plugin-clean-css
This will resolve the lessc command issue.
try this
sudo apt-get install node-clean-css
sudo apt-get install node-less
The solution:
sudo apt-get install node-clean-css
sudo apt-get install node-less
may work for Global system installation but if you are working within a virtualenv you may try this.
If somebody had the issue inside PyCharm wich was my case and nothing else works...
I leave my solution here:
First: I tried to check if node and npm exist inside my virtualenv: node -v and npm -v, not any of them... Second: I was using virtualenv, also when I ask inside my virtualenv with: which lessc . I didn't receive any response neither, so... I keep googling and found this post: How to install lessc and nodejs in a Python virtualenv?
In any case this was what I did on my virtualenv and the problem was solved:
MYVIRTUALENV/bin/activate # switch to my Python virtualenv first
pip3.7 install nodeenv # install nodeenv nodeenv was installed, in case you are using python 2.x use pip instead pip3
nodeenv --python-virtualenv # Use current python virtualenv
npm install -g less # install lessc in the virtualenv
npm install -g less-plugin-clean-css # also install this less-plugin...
then if I check with node -v and npm -v I get a proper response...
also get good response on: which lessc
After that no more nightmare with lessc execution in pycharm
When running my docker container it knows rbenv global. But when ever it try to find ruby via ruby or which ruby or whereis ruby I get nothing. It also doesn't recognize rails-api or gem. What is going on?
Dockerfile
FROM centos:6.6
RUN yum update -y
RUN yum install git openssl-devel openssh-server sudo openssl readline-devel readline zlib-devel zlib libxml2-devel libxml2 libxslt-devel libxslt nginx tar gcc libaio libaio-devel -y
RUN rpm -Uvh https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.5.1-1.el6.x86_64.rpm
RUN sed -i -e "s/Defaults requiretty.*/ #Defaults requiretty/g" /etc/sudoers
RUN mkdir -p /var/run/sshd
RUN useradd -m -u 1000 -G wheel deploy && echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/wheel
USER deploy
RUN mkdir ~/dev
RUN git clone https://github.com/sstephenson/rbenv.git ~/.rbenv/
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ENV PATH ~/.rbenv/bin:$PATH
RUN echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
RUN source ~/.bash_profile
ENV CONFIGURE_OPTS --disable-install-doc
RUN rbenv install 2.2.3
RUN rbenv global 2.2.3
RUN bash -l -c 'gem update --system'
RUN bash -l -c 'gem update'
RUN bash -l -c 'gem install nokogiri -- --use-system-libraries'
RUN bash -l -c 'gem install bundler rails-api --no-rdoc --no-ri'
COPY oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm /tmp/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
COPY oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm /tmp/oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
COPY oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm /tmp/oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
RUN sudo rpm -Uvh /tmp/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
RUN sudo rpm -Uvh /tmp/oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
RUN sudo rpm -Uvh /tmp/oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
RUN sudo touch /etc/sysconfig/network
RUN NLS_LANG=American_America.UTF8
ENV ORACLE_HOME=/usr/lib/oracle/12.1/client64
ENV LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
EXPOSE 22
EXPOSE 3000
EXPOSE 5000
The issue at hand here is that every RUN statement in the Dockerfile happens in its own environment. The RUN source ~/.bash_profile will set $PATH to have /root/.rbenv/shims in it. But subsequent RUN will not have this environment set as they won't source .bash_profile since this isn't an interactive shell.
The easy way to solve this is to just add a ENV PATH $HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH somewhere before the ruby and gem commands. This is really the only bit you should need from the rbenv init shell script.
Have you tried rbenv rehash after installing the new Ruby version?
Your Dockerfile only uses one version of Ruby. Given your use case, I would recommend just using the official ruby docker images: https://hub.docker.com/_/ruby