Env: node: no such file or directory in mac

I'm looking in google about how to show node js version or how will I work with npm? If i do it

npm -v

even i already install it with brew install node. Result always

env: node: No such file or directory

I have already decided many times for this, but could not. this is the command i tried already:

sudo apt-get install nodejs-legacy
sudo ln -s /usr/local/bin/node /usr/bin/node
brew unlink node
brew link node

I can not start the task because of this. Help me guys. This work before I used this command brew link --overwrite node. Now I have a problem, I no longer work with npm. I'm actually new to this. Now I do not know how to fix it.

Update

, npm list. , , npm install . " env: node: ", npm -v, . npm -v

+22
3

. Mac!

  • node

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh chmod +x ./uninstall-node.sh ./uninstall-node.sh rm uninstall-node.sh

: Node.js (Mac OS X)

, node . .

  1. node : https://nodejs.org/en/download/

nvm, :

nvm install node

, , : npm -v, node -v

nvm: command -v nvm

  1. npm, :

sudo npm uninstall npm -g

, , npm :

sudo make uninstall

nvm, : nvm uninstall npm

  1. npm, : npm install -g grunt
+30

:

$ brew uninstall --force node
$ brew uninstall --force npm

$ brew install node

simlinks

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
  rm '/usr/local/share/doc/node/gdbinit'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

$ brew link --overwrite node

.

+40

Let's see, I figured it out differently. in my case, the path was something like ~/.local/binthat, it seems, not the way he wants.

Try using the full path, for example /Users/tobias/.local/bin, change the variable PATHfrom ~/.local/binto /Users/tobias/.local/binor $HOME/.local/bin,

Now it works. 🙀🙀🙀

+1
source

Source: https://habr.com/ru/post/1016596/


All Articles