It was originally installed with brew, but now it prompts that the version is too low.
- Re-brew install node, installed a 9.4.
- But running node -v, it is always 4.6.
- Find the running path of node: which node
- It's fucking hidden here: /opt/local/bin
- Exclusion: sudo rm / opt / local / bin / node
Reinstall:
- brew install node
- cd /opt/local/bin/
- Establish a soft connection: ln -s /usr/local/Cellar/node/9.4.0/bin/node node
- Running node -v shows that the version is correct.
- But the npm version is too low, and then install npm: brew install npm, but it cannot be installed, prompting node has been installed! ! !
Node is also TMD too weird! ! !
Finally, go to https://nodejs.org/en/ and download a pkg file , after installation:
- Running node -v still doesn't work.
- Close and reopen the terminal window and node and npm finally work.
Also, on Linux, npm i always fails and needs to set up a proxy .
But npm config edit is useless, use the following method to set:
$npm config set proxy http://server:port
$npm config set https-proxy http://server:port
On MacOS, it is set uniformly in the network and set as a global proxy, and there is no such problem.
I got an error when doing npm install sha3:
[email protected] install: `node-gyp rebuild`
Someone said to do it with the following method ( https://github.com/nodejs/node-gyp/issues/773 ):
cd /usr/local/lib && sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
But I still can't.
On Ubuntu someone said to use ( https://github.com/phusion/node-sha3/issues/27 ):
apt-get -y install g++
or:
sudo apt-get install libgmp-dev
Still useless.
Finally, installed the 6x series on Ubuntu, installed g++, and it barely worked.