-Bash Shell Script "No such file or directory" - bash

Pretty new to coding and I am running into an error I've never seen before and would really appreciate any help navigating this :( Thank you!
I wanted to delete nvm, so I removed the folder following the advice given on StackOverflow. That FINALLY successfully deleted node from my mac (wanted to uninstall because I was running into dependency errors). The I used brew install to reinstall node. I can find the path to the node file (using which node). However when I run node -v I get the following bash (shell script??) error: -bash: /Users/Cindy/.nvm/versions/node/v12.14.1/bin/node: No such file or directory
I also followed #1219 and went into my bash_profile to delete the lines related to nvm. Now I don't know how to move forward with this.
I just want to be able to download node and run it properly to prepare for an interview in React and JS but I ran into these nasty bugs instead and morale is low. I'm lost now and I'm not sure if I just completely ruined my computer.

Related

Trying to run a Unix-exec file via MacOS Terminal results in "zsh: exec format error"

I'm on MacOS BigSur 11.4. I'm trying to run an executable file to start a Minecraft server from a folder of set up files associated with a Minecraft/Python coding book (https://nostarch.com/programwithminecraft).
My order of operations has been. 1) I moved to the file's path via cd/, 2) set the file's executable bit via: chmod +x ./NAME_OF_THE_FILE, and 3) try running the following command to execute the file: ./NAME_OF_THE_FILE
Another post advised that once I run those commands, going forward I just need to run the third command while in the files path. However, no matter how many things I try to I keep getting a "zsh: exec format error."
I suspect this has something to do with the book's publication being in 2015 when the current version of MacOS was Mountain Lion, which was before they switched from bash to zsh with all releases successive to Catalina. This would suggest I'm just formatting something wrong in a way that conflicts with the zsh syntax, but I can't figure it out. I'm searching around zsh format error related posts and they all discuss actions and conflicts that seem only tangentially related to my issue. Any help appreciated.
Thank you

Running "pod install" in automator action in Mac OS - Permission denied

I am currently grading approx 50 apps created by students whereas most of them use CocoaPods in their projects and I'm spending an awful lot of time just navigating in the terminal to different folders just to run "pod install". I googled a bit and found this page:
https://medium.com/#abhishekbedi/podfile-right-click-pod-install-5da88c89c907
Which is exactly what I want, but of course it doesn't work on my computer. I am not proficient in Terminal at all and I can't figure out what I'm missing, any help much appreciated!
Here's what I have in the automator action right now:
#!/bin/bash
file=$1
POD="/usr/local/bin/pod"
folder=dirname $file
cd $folder
LANG=en_US.UTF-8 $POD install
, which results in the following error:
Task ”Run command script” encountered an error: ”-: line 3: /Users/.../Podfile: Permission denied”
Maybe I got the text a bit wrong, I just translated it from Swedish.
I've tried chmod on /usr/local/bin/pod and both the file and folders (probably shouldn't have done that), but the error just got worse.
I want all necessary handling inside the script, since any terminal action would defeat the purpose of not having to use the terminal..
Ideas? Thanks

Mac OS terminal doesn't find commands

I have weird problem as all of the sudden terminal stopped reading any commands. Last weekend I installed Wordpress with PHP and mySQL and since that moment didn't have time to do anything more on laptop. Now I wanted to launch some react-native code but command wasn't found, then I tried different things to use some other commands and each time I get message
MBP-Mateusz-2:business-cards-native mateusz$ code .
-bash: code: command not found
and doesn't matter what command is that except standard ones like ls, cd etc. However when I try to write npm --version, or node --version, or launch visual studio code like before with code ., each time I get command not found. Doesn't anyone have issue like that? How to fix it as I'm super confused and have no idea even where to start.
You probably messed up your PATH environment variable, and now your computer cannot find the commands if you don't tell it directly where. The PATH variable contains the directories where the system should look for binaries if they're not in the current directory. If it gets corrupted for some reason, you won't be able to run any program from the terminal unless you pointed directly its location.
I would first run this command:
echo $PATH
so you can see which is the content of the PATH.
If it seems empty, or some critical folders are missing, try to add them temporarily:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Then try to run the commands again from the same terminal and see if that worked.
If that works, check if you have a ~/Library/LaunchAgents/environment.plist file and its content. It is possible that there is a key for the PATH and that its values are pointing something of your Wordpress stack but not the system directories.
If that looks fine, look at the ~/.bash_profile file. Find any export PATH instruction that may explain your issues. If you can't find any, but still exporting the PATH worked out, add at the end of the file that instruction as a workaround for fixing the mess:
export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
(notice that I'm ading $PATH in this last case so if there is any other path actually configured it is added as well)
Good luck.
EDIT: That's the usual issue people has, but now that I've read your comments, the issue seems a bit more serious. It looks like the mySQL setup destroyed your /usr/local/ folder, which means you lost all the binaries located there npm, code, etc.
If you have a backup of the whole filesystem (which by experience is unlikely), restore /usr/local folder.
If you don't have any backups, you can reconstruct /usr/local... by reinstalling the software that cannot be found. Reinstall npm, VSCode, etc, that will place their executables again in the /usr/local folders and from there you'll be good to go. Install brew (since it's likely that also got deleted) then try brew install node and see if now you can run npm. If that works out, I'm afraid you'll have to reinstall all the software you lost again.

MJML run and watch error

I'm following the tutorial on https://mjml.io/documentation/#basic-layout-example
And followed these instructions to install https://mjml.io/download
But whenever I want to use ./node_modules/.bin/mjml index.mjml or mjml index.mjml I get the following error:
Command 'sed' is available in '/bin/sed'
The command could not be located because '/bin' is not included in the
PATH environment variable.
sed: command not found
/usr/bin/env: 'node': No such file or directory
I have no idea what I'm doing wrong and Google hasn't been helpful so far.
Any idea why this is happening? Thanks for your time :(
Seems you have messed your PATH environment variable. The sed program is there as is part of the core packages. You can try to do something like the mentioned here.
Also try to reach the mjml support group in slack
I think you have not installed node properly. Try reinstalling it.
If you reinstalled the node and then also you are facing the problem then there is some problem with Windows because a few days ago I was facing a problem when I was running the npm run build command then I switch to my Virtual box Linux OS there it works fabulously.

.local/share/autojump/autojump_errors: No such file or directory

I've got autojump installed but, after upgrading homebrew, every time I issue a shell command (e.g. ls) I now get this:
-bash: /Users/snowcrash/.local/share/autojump/autojump_errors: No such file or directory
Any ideas on how to fix this?
I believe this used to be an issue but according to this GitHub Issue it should be fixed.
Otherwise I recommend you quit your current terminal application and restart. It took that for mine to stop throwing the error after I upgraded.

Resources