bash node command :no such file or directory - bash

I have uninstalled (manually) all files related to node, npm, nvm on my MacOs as I would like to start managing everything through homebrew.
After uninstalling everything, and installing node with brew install nod -g, I ran node versionin my terminal to have the following error thrown at me:
-bash: /Users/{username}/.nvm/versions/node/v10.1.0/bin/node: No such file or directory
I am sure it has to do with a symlink somewhere that I should remove/edit, but I really have no clue where to find this and how to modify it.
Assistance would be appreciated :)

solved by adding the following to .bash-profile:
# Node path
export NODE_PATH="/usr/local/lib/node_modules"

Related

ROOT installation on MacOs

ROOT is required as a pre-requisite for some software that I am trying to install. I'm on a MacOs system and I have tried to install using brew install root. Do I need to do anything else? How can I check that root was successfully installed?
When I tried to install said software, apparently files in the root directory cannot be found, e.g. error
/usr/local/Cellar/root/6.22.06_1/etc/root/cling/lib/clang/5.0.0/include/assert.h:8:15: fatal error: 'assert.h' file not found
I have checked this manually and the file is there so I don't understand why it is not found. I also tried the following line in my .zshrc file
export PATH=$PATH:/usr/local/Cellar/root/6.22.06_1/etc/root/cling/lib/clang/5.0.0/include/assert.h
and
export PATH=$PATH:/usr/local/bin/thisroot.sh
Any ideas of what may be going wrong? Thanks in advance

Why doesn't zsh recognize command from globally installed npm package?

After installing oh-my-zsh and reinstalling node and npm again, I install npm-check-updates globally and try to call 'ncu' (the npm-check-updates command). However, I get an error: zsh:
command not found: ncu. Does anyone know how to fix this?
I have corrected this problem with the following instructions:
sudo npm install -g npm-check-updates
Make sure the 'ncu' package can be found in the $PATH environment variable. Try this, to find where 'ncu' is supposed to be installed:
which ncu
If it still gives you trouble, try to see if it's in /usr/bin, $HOME/npm/bin, /usr/local/lib or /usr/sbin, and check that your $PATH environment variable contains a way to 'ncu'. Your $PATH environment variable, which can be found in
$HOME/.bashrc (Linux)
$HOME/.bash_profile (MacOS)
should look something like this:
export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/npm/bin
After an install you can run rehash so zsh will analyse what new executables are available on $PATH.
Not sure if that would fix the problem, I know it fixes the missing tab completion entry after install.
FYI I am using a OSX.
The problem was that my export path in my .zshrc was wrong.
This was what it was previously:
export PATH=$HOME/bin:/usr/local/bin:$PATH.
Notice there is nothing pointing at npm or any of the packages I installed globally.
For anyone who has this problem in the future...
Ensure that npm is installed and that you can still run npm commands (if not uninstall then install npm). Then run npm -g list --depth 0 to list all your global packages.
Go into your home folder and press ⌘+Shift+. (shows all hidden files/folders), there should be a .npm folder there, ensure the packages in the list you obtained in the previous step matches what's in the bin folder.
Edit your export PATH string accordingly:
export PATH=$HOME/bin:/usr/local/bin:**$HOME/.npm/bin**:$PATH.
This worked for me!

Keep getting: No such File or directory when I open the Terminal

Every time I open the terminal I keep getting this:
bash: /usr/local/Cellar/nvm/0.33.0/nvm.sh: No such file or directory
I have tried reloading. No idea why all of a sudden this has come up. Any guesses guys?
You need to update your nvm via homebrew:
brew upgrade nvm
I was getting the same error after I installed another NVM version manually (forgetting that I have had installed an older version via homebrew).
That resulted in a wrong path within configuration in your .bash_profile, .bashrc or any other similar file which gets started each time you run a new terminal window.
According to https://github.com/creationix/nvm#installation, look for something like
export NVM_DIR=~/.nvm
[ -s $NVM_DIR/nvm.sh ] && . $NVM_DIR/nvm.sh
This configuration is normally set while installing of NVM. I have had a wrong path in it, die above will work when your NVM resides in ~/.nvm
Hope that helps you.

zsh command not found, likely path issue

I recently switched to zsh from bash and couldn't install any npm bundles. I found some stack overflows telling me to reset the path in my zsh profile, which I did. Now I can't execute any commands, including bundle install.
Things I've tried:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
export path
from the command line
Modifying ~/.zshrc to add
PATH=/usr/bin:/bin:/usr/sbin:/sbin
export PATH
, then saving and restarting iTerm.
When I echo $PATH, this is what I get: /usr/bin:/bin:/usr/sbin:/sbin
Restarting my terminal after each change, I still get: zsh: command not found: bundle
Help would be greatly appreciated!
UPDATE: I tried switching to another computer and cloning the repo down and am getting the same error when I try to bundle install. If I switch to another repo on the other computer (where I didn't mess with the path), bundle install works. On my initial computer (with the path edits), none of the repos allow bundle install.
Do you know where is your bundle program (you can use locate or find) ? It can be in another directory that is not in your path. For example, it can be in /usr/local/bin so you should add this path to your $PATH.

npm command not found after restart

The npm command keeps becoming unrecognised after a computer restart:
-bash: npm: command not found
The node command still works fine, it's just npm that's not working. I have to reinstall Node.js from the main site to get it working again.
~/bin is added to my $PATH in my .bash_profile with:
export PATH="$HOME/bin:$PATH"
Edit: I'm also using the full mathiasbynens/dotfiles which manages its own version, I wonder if there's a conflict here.
According to nvm readme file, try to run this once:
nvm alias default stable
This will set a default Node version to be used in any new shell.
I have no explanation, but a few pointers:
As #LaurentPerrin states, node (via its official installer package) installs to /usr/local/bin.
(Why do you mention ~/bin?)
Note that different rules apply if you use user-level installs via node.js version manager nvm, in which case [symlinks to] executables are placed in ~/.nvm/v{version}/bin
Thus, the node executable should be /usr/local/bin/node.
Is this (only) what you see when you run which -a node?
The node executable is placed directly in /usr/local/bin, whereas npm is merely a symlink that points to /usr/local/lib/node_modules/npm/bin/npm-cli.js, which is an executable node script with shebang line #!/usr/bin/env node.
When you run
ls -l /usr/local/bin/npm
you should see something like
lrwxr-xr-x 1 root wheel 38 Dec 13 11:52 /usr/local/bin/npm -> \
../lib/node_modules/npm/bin/npm-cli.js
See if the symlink exists and points to the right file.
If that still doesn't work, try to invoke npm-cli.js directly and see what happens (this should show npm's command-line help):
/usr/local/lib/node_modules/npm/bin/npm-cli.js help
On OSX, node is installed to /usr/local/bin, which needs to be in your path. Edit /edit/paths as root (sudo nano /etc/paths) and make sure it is on the first line. It should look like this:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Then you can force bash to refresh paths by running: source /etc/profile.
I was having the same problem (on OSX). Not sure if this is the solution for you, but I ended up finding npm here:
.nvm/v0.10.22/bin
or, based on your version
.nvm/v0.10.21/bin
Then I just printed my working directory and added that to my path. So for me, when I opened terminal:
cd .nvm/v0.10.22/bin
pwd
>> /path/to/.nvm/v0.10.22/bin
Hope that helps.
I use nvm to install node.js. I solve it by adding $HOME/.nvm/v0.10.25/bin to $PATH. So the problem is that the path can not be found.
I have the same problem. My solution is use sudo .... My guess this is because of the permission problem.

Resources