What is the suggested way to install brew, node.js, io.js, nvm, npm on OS X?

后端 未结 9 1181
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 15:51

I am trying to use homebrew as much as possible. What\'s the suggested way to install the following on OS X?

  • node.js
  • io.js
  • nvm
  • npm
相关标签:
9条回答
  • 2020-11-30 16:44

    2019 update: Use NVM to install node, not Homebrew

    In most of the answers , recommended way to install nvm is to use Homebrew

    Do not do that

    At Github Page for nvm it is clearly called out:

    Homebrew installation is not supported. If you have issues with homebrew-installed nvm, please brew uninstall it, and install it using the instructions below, before filing an issue.

    Use the following method instead

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    

    The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

    And then use nvm to install node. For example to install latest LTS version do:

    nvm install v8.11.1
    

    Clean and hassle free. It would mark this as your default node version as well so you should be all set

    0 讨论(0)
  • 2020-11-30 16:47

    You should install node.js with nvm, because that way you do not have to provide superuser privileges when installing global packages (you can simply execute "npm install -g packagename" without prepending 'sudo').

    Brew is fantastic for other things, however. I tend to be biased towards Bower whenever I have the option to install something with Bower.

    0 讨论(0)
  • 2020-11-30 16:48

    Here's what I do:

    curl https://raw.githubusercontent.com/creationix/nvm/v0.20.0/install.sh | bash
    cd / && . ~/.nvm/nvm.sh && nvm install 0.10.35
    . ~/.nvm/nvm.sh && nvm alias default 0.10.35
    

    No Homebrew for this one.

    nvm soon will support io.js, but not at time of posting: https://github.com/creationix/nvm/issues/590

    Then install everything else, per-project, with a package.json and npm install.

    0 讨论(0)
提交回复
热议问题