![]() nvmrc files in your project root directories. nvmrc file in your home directory to define your prefered version globally. There are the two following ways to accomplish this. ![]() You need to set a default version if you dont want to be surprised by switched versions with every opened Terminal window/tab. ![]() This will reinstall global packages contained in to the current version in use. You can »transfer« your global packages from one version to another at any given time. You also can use more explicit versions like this: nvm install 6.2 -reinstall-packages-from=6.0 This will install the latest release and reinstall the globally installed packages from the predecessor. The easiest one is to take care of that after during installation of a new node version with: nvm install node -reinstall-packages-from=node Thankfully nvm offers to ways to accomplish that. This is something you want to automate since releases of Node.js are pretty frequent (for a good reason). Please note that you have to install global packages with every node version your are using with nvm. In place of a version pointer like “6”, you can use the special default aliases like “stable” and “unstable”: nvm install stable You will use the latest installed version automatically after installation. Let’s install the latest v5.x.x release in addition: nvm install 5 To download, compile, and install the (currently) latest v6.x.x release of node, do this: nvm install 6 In case of the homebrew installation it is: export NVM_DIR=~/.nvm Please have a look at in case you would like to do a manual install.Įither way you have to add a few lines to your ~/.bash_profile, ~/.zshrc or ~/.profile. I prefer installing it via homebrew: $ brew update Installing the Node Version Manager (nvm) Do yourself a favor and remove that to prevent possible issues with linking globale packages via npm link. Potential problems with linking global packagesĭouble check if there still is a node_modules directory in /usr/local/lib holding your globally installed packages. Let’s get rid of this and older versions in the cellar of homebrew: $ brew uninstall -force node But I have to be able to use a different Node version just in case thinks break with Node 4.0.įirst we could check which version of node we are using: $ node -v This became more important since the stable release of Node 4.0 which I like to use. But beside the quirk when it comes to updating npm there is a method which makes switching Node.js version even easier. Sure you can just use homebrew to update your Node.js installation when there are new releases.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |