"command not found: mongod" error despite updating PATH - mongodb

I have added this line
export PATH=$PATH:"/Users/pouya/mongodb/bin:$PATH"
to my .bash_profile, but I still get this error:
zsh: command not found: mongod
I use macOS Catalina, and this happened to me with MongoDB.
I can't use Brew because of restrictions on my country and I want to install MongoDB manually, how can I do that?

For macOS Catalina the zsh is the default shell, so you should at this line to ~/.zshrc file
vim ~/.zshrc
export PATH=$PATH:"/Users/pouya/mongodb/bin:$PATH"
source ~/.zshrc

Related

VSCode asdf-vm command no such file or directory

Specs
VSCode 1.63.2
Homebrew 3.3.10
asdf 0.9.0
MacOS Monterey
Problem
I installed asdf via Homebrew as per doc http://asdf-vm.com/guide/getting-started.html#_3-install-asdf
The asdf command works well in my iTerm. However, it didn't work when committing or pushing via VScode terminal and VSCode source control.
The error from VSCode terminal
Unknown command: `asdf exec npm run pre-commit`
/usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf: line 82: /usr/local/opt/asdf/lib/commands/command-help.bash: No such file or directory
And this below from VSCode source control
The error I got in output.
> git push origin feature/my-branch
Unknown command: `asdf exec npm run pre-commit`
/usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf: line 82: /usr/local/opt/asdf/lib/commands/command-help.bash: No such file or directory
Running asdf exec npm run pre-commit in my iTerm works well. There must be different configuration between zsh in iTerm vs in VSCode. 🤔
My attempt so far is to add this configuration in VSCode settings.json
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.defaultProfile.osx": "zsh"
but still not working
My ~/.zshrc setup for asdf
. /usr/local/opt/asdf/libexec/asdf.sh
What is the possible cause here?
Found dubious decision
I also dont have commands folder in asdf/lib
So I copied the same from asdf/libexec/lib
And it worked

How to open Visual Studio Code from the command line on RHEL?

I would like to open VSCode from my RHEL terminal using the code command but when I try to type Shell Command: Install 'code' command in PATH directly in VSCode Command Palette, it indicates that No matching command is found. Is there a way to configure $PATH directly via the command line to make code work?
Finally what worked for me was to run the following commands :
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
dnf check-update
sudo dnf install code

command not found: mongo, after it's installed (OS X)

After following official instructions here to install mongo-community, it cannot find the command to start mongo.
Steps I used to install mongo:
brew tap mongodb/brew
brew install mongodb-community#3.6
The installation was successful, but when I tried to start mongo with mongo. This error appears:
zsh: command not found: mongo
Tried the solutions at Mongod: Command Not Found (OS X), none of them worked.
Also, can't seem to find where mongo is located.
Thank in advance!
Add the path to "mongo" to your terminal shell:
export PATH="$PATH:/usr/local/Cellar/mongodb-community#3.6/3.6.14/bin"
(replace version number with your local version)
It cannot find the command since $PATH is not set correctly. After MongoDB moved from open source to community liscence on Oct 16, 2018, the installation path on Mac changed. It's installed in /usr/local/Cellar (reference: Location of the mongodb database on mac).
Thanks to #kevinadi for point out the issue.
mongodb shell reference
In my case I couldn't find mongo command as 2022, so I used mongosh
and it worked fine.

flutter error on ubuntu 18.04 'flutter' command not found

I'm trying to install flutter on ubuntu 18.04. After downloading the flutter package from link, I set the PATH variables, after that whenever I try to execute flutter on terminal it was giving an error command not found.
Even I try to execute flutter command inside flutter/bin the result remains the same!
I tried to restart and check then also result remains the same.
This is how my .bash_profile looks like
rajath#rajath-Inspiron:~/Downloads/flutter/bin$ cat ~/.bash_profile
export JAVA_HOME=/usr/lib/jvm/default-java
export ANDROID_HOME=/opt/Android
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=/Downloads/flutter/bin:$PATH
Error log:
rajath#rajath-Inspiron:~/Downloads/flutter/bin$ flutter doctor
flutter: command not found
rajath#rajath-Inspiron:~/Downloads/flutter/bin$ flutter
flutter: command not found
rajath#rajath-Inspiron:~/Downloads/flutter/bin$
Any kind of help will much much appreciated!!!
You can also add export PATH=$PATH:~/Downloads/flutter/bin to your ~/.bashrc.
That will add the flutter path to your path variable everytime you start a new bash.
And maybe you should install flutter anywhere near /usr/
As worldpotato said, You must add to your .bashrc file (or .bash_profile)
You can run the command
echo 'export PATH="$PATH:~/Downloads/flutter/bin"' >> ~/.bashrc
and
echo 'export PATH="$PATH:~/Downloads/flutter/bin"' >> ~/.bash_profile

Visual Studio Code, autopep8 doesn't run

On Windows 10.
I did this:
pip install autopep8
and in vscode user settings I have
"python.linting.pep8Enabled": true,
"python.formatting.provider": "autopep8",
When I run format document, or explicitly invoke autopep8 from the command pallette, the error is:
Error: Command failed: autopep8 c:\tca-backend\lambdas\utilities\NetMenuAPIUtil.py
'autopep8' is not recognized as an internal or external command,
operable program or batch file.
Clearly, vsc wants to invoke autopep8.exe but there is no exe. Just py. So I created a autopep8.bat which works when I test from the command line, but when run from vsc, it inserts the content of the batch file into the top of the document. (Yes, that's as strange as it sounds.)
All other Python-related operations work ok, including the ESLint extension.
VS code Python extension supports source code formatting using either autopep8 (the default), black, or yapf so you don't need to install python formatting tools by yourself.
The way I use formatting is to set a shortcut in vs code.
Go to File -> Preferences -> Keyboard Shortcuts, then search format. Set the shortcut as ctrl + shift + p which is the same as the shortcut of autopep8 or you can set any combination you prefer.
Click the shortcuts in your .py files then you will get the formatted code.
Ref: https://code.visualstudio.com/docs/python/editing
Since you are using VSCode on Windows, please click on the Terminal Section and type
pip install pep8
This will start installing pep8.
for me, the autopep8 doc installation isn't enough, still seeing this error, I had to follow this https://pip.pypa.io/en/latest/user_guide/#user-installs. it works like a charm.
I'm on windows so I used this:
py -m pip install –-user autopep8
You need to add this as a PATH under System Environment Variables:
c:\users\<username>\appdata\roaming\python\python39\site-packages
Then close and restart VS Code. Type autopep8 at a terminal prompt and you should see this:
C:\Foobar>autopep8
usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename] [--ignore-local-config] [-r] [-j n] [-p n] [-a] [--experimental] [--exclude globs] [--list-fixes] [--ignore errors] [--select errors]
[--max-line-length n] [--line-range line line] [--hang-closing] [--exit-code]
[files ...]
autopep8: error: incorrect number of arguments
I encountered an error message while trying to do same and below was what I did (in my terminal):
Install or upgrade pep8:
pip install --upgrade autopep8
Navigate to the folder/directory where the file you need formatted is, then use the following command:
autopep8 --in-place file_name
There you have it!
I encountered this same error running WSL: Ubuntu-20.04, well this was my solution:
$ pip --version
This will make you verify that you have python3 pip installed correctly in your distribution, if that's not the case, it will pop up an error:
Command 'pip' not found, but can be installed with:
apt install python3-pip
Just run the indicated command to installed it and then after that, run:
$ python3 -m pip install autopep8
Now everything should be working as it should, including the formatting autpep8.