Can't run Yarn on fish shell on MAC Ventura with nvm - macos

in my MAC with Ventura os I can't run yarn on fish shell:
fish: Unknown command: yarn
I tried to run the following command according to the documentation:
set -U fish_user_paths (yarn global bin) $fish_user_paths
After running it, yarn works fine on fish shell.
However after reboot it stops working again.
I tried also to edit the config.fish file with:
if status is-interactive
# Commands to run in interactive sessions can go here
end
set -U fish_user_paths (yarn global bin) $fish_user_paths
But after reboot nothing changes...
In the variables I see:
fish_user_paths /Users/myusername/.yarn/bin
'/Users/myusername/.yarn/bin' '/usr/local/bin' '/System/Cryptexes/App/usr/bin' '/usr/bin' '/bin' '/usr/sbin' '/sbin'
However in the /Users/myusername/.yarn/bin path I see:
~/.y/bin> ls -la
total 0
drwxr-xr-x 3 myusername group 96 Feb 7 15:29 ./
drwxr-xr-x 3 myusername group 96 Feb 7 15:29 ../
lrwxr-xr-x 1 myusername group 59 Feb 7 15:29 create-next-app# -> ../../.config/yarn/global/node_modules/.bin/create-next-app
Can anyone please help?

Related

How To Docker Copy to user root ~

I'm writing a Dockerfile to run ROS on my Windows rig and I can't seem to get this COPY command to copy to the container's user root or any sub directory there. I've tried a few things, including messing with the ownership. I know file is ugly but still learning. Not really sure what the issue is here.
This file sits next to a /repos dir which has a git repo within it which can be found here (the ros-noetic branch). This is also the location from which I build and run the container from.
Overall objective is to get roscore to run (which it has been), then exec in with another terminal and get rosrun ros_essentials_cpp (node name) to actually work
# ros-noetic with other stuff added
FROM osrf/ros:noetic-desktop-full
SHELL ["/bin/bash", "-c"]
RUN apt update
RUN apt install -y git
RUN apt-get update && apt-get -y install cmake protobuf-compiler
RUN bash
RUN . /opt/ros/noetic/setup.bash && mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/ && chmod 777 src && catkin_make && . devel/setup.bash
RUN cd /
RUN mkdir /repos
COPY /repos ~/catkin_ws/src
RUN echo ". /opt/ros/noetic/setup.bash" >> ~/.bashrc
Expanding tilde to home directory is a shell feature, which apparently isn't supported in Dockerfile's COPY command. You're putting the files into a directory which is literally named ~, i.e. your container image probably contains something like this:
...
dr-xr-xr-x 13 root root 0 Jun 9 00:07 sys
drwxrwxrwt 7 root root 4096 Nov 13 2020 tmp
drwxr-xr-x 13 root root 4096 Nov 13 2020 usr
drwxr-xr-x 18 root root 4096 Nov 13 2020 var
drwxr-xr-x 2 root root 4096 Jun 9 00:07 ~ <--- !!!
Since root's home directory is always /root, you can use this:
COPY /repos /root/catkin_ws/src
You need to pay attention on the docker context.
When you build docker, you are adding the path to build your image.
If you are not on the / folder, your COPY /repos command won't work.
Try to change the docker context with that:
docker build /

How can I run bash in a new container of a docker image?

I am able to run arbitrary shell commands in a container created from docker/whalesay image.
$ docker run docker/whalesay ls -l
total 56
-rw-r--r-- 1 root root 931 May 25 2015 ChangeLog
-rw-r--r-- 1 root root 385 May 25 2015 INSTALL
-rw-r--r-- 1 root root 1116 May 25 2015 LICENSE
-rw-r--r-- 1 root root 445 May 25 2015 MANIFEST
-rw-r--r-- 1 root root 1610 May 25 2015 README
-rw-r--r-- 1 root root 879 May 25 2015 Wrap.pm.diff
drwxr-xr-x 2 root root 4096 May 25 2015 cows
-rwxr-xr-x 1 root root 4129 May 25 2015 cowsay
-rw-r--r-- 1 root root 4690 May 25 2015 cowsay.1
-rw-r--r-- 1 root root 54 May 25 2015 install.pl
-rwxr-xr-x 1 root root 2046 May 25 2015 install.sh
-rw-r--r-- 1 root root 631 May 25 2015 pgp_public_key.txt
$ docker run docker/whalesay lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
However, I am unable to run a shell in a container created from this image.
$ docker run docker/whalesay bash
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ce600cc9904 docker/whalesay "bash" 5 seconds ago Exited (0) 3 seconds ago loving_mayer
Why did it not work? How can I make it work?
If you docker run without attaching a tty, and only call bash, then bash finds nothing to do, and it exits. That's because by default, a container is non-interactive, and a shell that runs in non-interactive mode expects a script to run. Absent that, it will exit.
To run a disposable new container, you can simply attach a tty and standard input:
docker run --rm -it --entrypoint bash <image-name-or-id>
Or to prevent the above container from being disposed, run it without --rm.
Or to enter a running container, use exec instead:
docker exec -it <container-name-or-id> bash
In comments you asked
Do you know what is the difference between this and docker run -it --entrypoint bash docker/whalesay?
In the two commands above, you are specifying bash as the CMD. In this command, you are specifying bash as the ENTRYPOINT.
Every container is run using a combination of ENTRYPOINT and CMD. If you (or the image) does not specify ENTRYPOINT, the default entrypoint is /bin/sh -c.
So in the earlier two commands, if you run bash as the CMD, and the default ENTRYPOINT is used, then the container will be run using
/bin/sh -c bash
If you specify --entrypoint bash, then instead it runs
bash <command>
Where <command> is the CMD specified in the image (if any is specified).

RHEL Environment Variable Path To Mongo Shell

I have installed mongodb in one of our environments & this has been done using MongoDb Operations Manager. Though i have my PATH variable set correctly i'm unable to connect mongo shell with my user account but able to connect as a sudo. could someone help me if i'm missing anything here.
Details:
[user01#west.company.com#rhel01 /]$ echo $PATH
> /var/lib/mongodb-mms-automation/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/nfs/home/user01/.local/bin:/nfs/home/user01/bin
[user01#west.company.com#rhel01 /]$ mongo
> -bash: mongo: command not found
[user01#west.company.com#rhel01 /]$ sudo -i
[sudo] password for user01#west.company.com:
[root#rhel01 ~]# echo $PATH
> /var/lib/mongodb-mms-automation/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root#rhel01 ~]# mongo
> MongoDB shell
> version: 3.2.10 connecting to: test
> MongoDB Enterprise MYMONGOREPLSET01:PRIMARY>
Which Mongo Output:
[user01#west.company.com#rhel01 /]$ which mongo
/usr/bin/which: no mongo in (/var/lib/mongodb-mms-automation/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/nfs/home/user01/.local/bin:/nfs/home/user01/bin)
[root#rhel01 ~]# which mongo
/var/lib/mongodb-mms-automation/bin/mongo
Observation:
i just noticed the bin location is set like this ...
[root#rhel01 mongodb-mms-automation]# pwd
/var/lib/mongodb-mms-automation
[root#rhel01 mongodb-mms-automation]# ls -la
total 32
drwxr-xr-x 3 mongod mongod 4096 Mar 30 13:58 .
drwxr-xr-x. 57 root root 4096 Apr 1 03:23 ..
lrwxrwxrwx 1 mongod mongod 67 Nov 4 13:45 bin -> /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin
-rw------- 1 mongod mongod 1024 Mar 27 15:07 keyfile
-rw------- 1 mongod mongod 10686 Mar 30 13:58 mms-cluster-config-backup.json
drwxr-x--- 4 mongod mongod 4096 Nov 4 13:45 mongodb-linux-x86_64-3.2.10-ent
Try this
sudo chmod -R 777 /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin/
add this to path /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin

Can't start MongoDB on OSX

I'm trying to run MongoDB on OSX and encountering a common problem, Error with exit code 1.
Here's my very simple mongod.conf:
systemLog:
destination: file
logAppend: true
path: ~/Documents/test/mongodb/mongodb.log
storage:
directoryPerDB: true
dbPath: ~/Documents/test/mongodb/mongodb_data
journal:
enabled: true
processManagement:
fork: true # fork and run in background
net:
port: 27017
I 777'd all the folders so there's no way it can be a permissions issue (right? :P)
mac$ ls -lah ~/Documents/test/mongodb/
total 8
drwxr-xr-x 5 mac staff 170B Dec 4 15:34 .
drwxr-xr-x 11 mac staff 374B Dec 4 15:19 ..
-rwxrwxrwx 1 mac staff 301B Dec 4 15:21 mongod.conf
-rwxrwxrwx 1 mac staff 0B Dec 4 15:21 mongodb.log
drwxrwxrwx 2 mac staff 68B Dec 4 15:18 mongodb_data
But it still gets this error code!
mac$ sudo mongod -f ~/Documents/test/mongodb/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 70062
ERROR: child process failed, exited with error number 1
Things I've tried from other questions:
Apparently I shouldn't have to run this as sudo (?), I've tried both sudo and no sudo, same result
Could be a permissions issue (Starting mongod fails unless run as root) - well the mongodb_data directory and the conf and log are all 777 so can that really be the case? I've tried chown on all of them too but no effect.
Remove the pid location in your mongod.conf (done, doesn't have any effect) Starting mongod fork, ERROR: child process failed, exited with error number 1
Also:
mongodb.log has nothing in it after multiple start attempts
mongodb_data/ has nothing in it either (no .lock file or whatever, just empty)
Any ideas?
This is probably error with log file. It's strange that yours is 0 bytes.
Anyway you do not need to make 777 permissions, you do not need to run mongod with sudo on OSX system.
Try to do the following:
mkdir ~/sometest
cd ~/sometest
cp ~/Documents/test/mongodb/mongod.conf .
Replace systemLog path to mongodb.log, replace dbpath to data
mkdir data
Start mongod (mongod -f mongod.conf)

Modifying /private/etc/paths did not change $PATH after a reboot

On a rMBP here. I'm not sure what the script is that is responsible for doing this. Basically I want to add the path to python utils to the $PATH...
For example, I brewed python brew python in order to get pip, then ran pip install flake8. Now
$ which flake8
flake8 not found
$ find / | grep flake8
...
......
/usr/local/share/python/flake8
$ ls -la /usr/local/share/python/
total 32
drwxr-xr-x 6 lust admin 204 Apr 2 18:15 .
drwxr-xr-x 15 lust admin 510 Apr 2 18:12 ..
lrwxr-xr-x 1 lust admin 45 Apr 2 18:13 Extras -> ../../Cellar/python/2.7.3/share/python/Extras
-rwxr-xr-x 1 lust admin 389 Apr 2 18:15 flake8
-rwxr-xr-x 1 lust admin 385 Apr 2 18:15 pep8
-rwxr-xr-x 1 lust admin 405 Apr 2 18:15 pyflakes
Alright!
$ cat /private/etc/paths
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
$ sudo vim /private/etc/paths
$ cat /private/etc/paths
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/share/python
Make a new shell, check $PATH, python not there. Okay.
Reboot, start a new shell, check $PATH, python still not there.
Oh, by the way, the solution is not to append, with anything like export PATH=$PATH:newpath, because I don't actually care to run flake8 from the command-line, I want Sublime Text 3' SublimeLinter plugin to actually know where it is without putting some hacky config in the settings for the editor.
I found the problem. As part of oh-my-zsh, zsh is set up to set PATH in the ~/.zshrc. I failed to consider this. When starting ST3 without using the command line invocation, it gains its own (incorrect) path environment variable, so that part still doesn't work. The ultimate resolution to the problem, however, is here.

Resources