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

后端 未结 9 1188
佛祖请我去吃肉
佛祖请我去吃肉 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:31

    I'm super late to this but I didn't like the other answers

    Installing Homebrew

    For brew run

    "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    Installing node & npm

    You SHOULD NOT use brew to install node and npm.

    I've seen a few places suggested that you should use Homebrew to install Node (like alexpods answer and in this Team Treehouse blog Post) but installing this way you're more prone to run into issues as npm and brew are both package managers and you should have a package manager manage another package manager this leads to problems, like this bug offical npm issues Error: Refusing to delete: /usr/local/bin/npm or this Can't uninstall npm module on OSX

    You can read more on the topic in DanHerbert's post Fixing npm On Mac OS X for Homebrew Users, where he goes on to say

    Also, using the Homebrew installation of npm will require you to use sudo when installing global packages. Since one of the core ideas behind Homebrew is that apps can be installed without giving them root access, this is a bad idea.

    For Everything else

    I'd use npm; but you really should just follow the install instruction for each modules following the directions on there website as they will be more aware of any issue or bug they have than anyone else

提交回复
热议问题