最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Mac中重新安装v9或v10的node

Mac crifan 3937浏览 0评论
折腾:
【未解决】gitbook install报错:TypeError Cannot set property readableListening of undefined
期间,之前已有版本:
~  brew info node
node: stable 15.6.0 (bottled), HEAD
Platform built on V8 to build network applications
https://nodejs.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/node.rb
License: MIT
==> Dependencies
Build: pkg-config ✔, [email protected] ✔
Required: icu4c ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 327,096 (30 days), 1,071,598 (90 days), 4,379,923 (365 days)
install-on-request: 238,495 (30 days), 780,661 (90 days), 3,190,488 (365 days)
build-error: 0 (30 days)
mac reinstall node 9
javascript – How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) – Stack Overflow
mac install node v9
卸载,安装旧的版本
 xxx@xxx  ~  brew uninstall node
Uninstalling /usr/local/Cellar/node/15.6.0... (3,292 files, 55.8MB)
 xxx@xxx  ~  brew install node@9
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
luv
==> Updated Formulae
Updated 47 formulae.


==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "node@9".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
mac install specific version node
How to install specific NodeJS version | by katopz | Medium
 ~  brew search node
==> Formulae
libbitcoin-node     node                node-sass           node@12             node_exporter       nodeenv
llnode              node-build          node@10             node@14             nodebrew            nodenv
==> Casks
nodebox                                                       nodeclipse


If you meant "node" specifically:
It was migrated from homebrew/cask to homebrew/core.
没有node v9
Mac Install specific version of Node
macos – How do I downgrade node or install a specific previous version using homebrew? – Ask Different
javascript – How to brew install specific version of Node? – Stack Overflow
算了,没有v9的
先去安装v10的试试
  brew install node@10
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> New Casks
aegisub                                                       the-unofficial-homestuck-collection
==> Updated Casks
Updated 93 casks.
==> Deleted Casks
evom                irip                ringtones           ripit               tagalicious         teamspeak-client


==> Downloading https://homebrew.bintray.com/bottles/node%4010-10.23.1.mojave.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/da429b4bd778eae04b4bdbe1a9cca7bb53183bef25d4c4ffa63840646fcaf00
######################################################################## 100.0%
==> Pouring [email protected]
==> Caveats
node@10 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.


If you need to have node@10 first in your PATH run:
  echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.zshrc


For compilers to find node@10 you may need to set:
  export LDFLAGS="-L/usr/local/opt/node@10/lib"
  export CPPFLAGS="-I/usr/local/opt/node@10/include"


==> Summary
🍺  /usr/local/Cellar/node@10/10.23.1: 4,308 files, 53MB
但是:
 xxx@xxx  ~  npm --version
env: node: No such file or directory
 ✘ xxx@xxx  ~  node --version
zsh: command not found: node
去试试:
 ~  brew link node@10
Linking /usr/local/Cellar/node@10/10.23.1...
Error: Could not symlink bin/npm
Target /usr/local/bin/npm
already exists. You may want to remove it:
  rm '/usr/local/bin/npm'


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


To list all files that would be deleted:
  brew link --overwrite --dry-run node@10
根据提示操作:
 ~  rm '/usr/local/bin/npm’
 ~  brew link --overwrite node@10
Linking /usr/local/Cellar/node@10/10.23.1... 3859 symlinks created


If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.zshrc
然后可以找到了:
~  node --version
v10.23.1
~  npm --version
6.14.10
然后回去看看gitbook install是否OK
另外也去安装nvm:
 ~  brew install nvm
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 1 formula.


==> Downloading https://github.com/creationix/nvm/archive/v0.37.2.tar.gz
==> Downloading from https://codeload.github.com/nvm-sh/nvm/tar.gz/v0.37.2
######################################################################## 100.0%
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.


You should create NVM's working directory if it doesn't exist:


  mkdir ~/.nvm


Add the following to ~/.zshrc or your desired shell
configuration file:


  export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion


You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.


Type `nvm help` for further information.
==> Summary
🍺  /usr/local/Cellar/nvm/0.37.2: 7 files, 171.2KB, built in 5 seconds
 xxx@xxx  ~  nvm --version
zsh: command not found: nvm ~  brew install nvm
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 1 formula.


==> Downloading https://github.com/creationix/nvm/archive/v0.37.2.tar.gz
==> Downloading from https://codeload.github.com/nvm-sh/nvm/tar.gz/v0.37.2
######################################################################## 100.0%
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.


You should create NVM's working directory if it doesn't exist:


  mkdir ~/.nvm


Add the following to ~/.zshrc or your desired shell
configuration file:


  export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion


You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.


Type `nvm help` for further information.
==> Summary
🍺  /usr/local/Cellar/nvm/0.37.2: 7 files, 171.2KB, built in 5 seconds
 xxx@xxx  ~  nvm --version
zsh: command not found: nvm
结果:gitbook install问题依旧。

转载请注明:在路上 » 【已解决】Mac中重新安装v9或v10的node

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.181 seconds, using 22.16MB memory