Install Different Node Version on Mac

Whether npm or other front-ent package manager tools are all writtent by node, therefor, if we want to use it, we should install node at first.

https://nodejs.org/en/

After installing node, we will get npm to manage your javascript packages.

As we all know, npm is a package manager for JavaScript and word‘s largest software register. Recently, I found a tool like npm and more stronger than npm on mac system, that is Hombrew. So maybe you will ask what‘s the difference between npm and homebrew

  • Difference between homebrew and npm

    This is a rough, inaccurate answer, but it’s very easy to understand and it can give you a quick preview:
    
    Homebrew is like the Mac App Store: it installs softwares that can be used in the whole system.
    npm is like the Extension manager in Chrome: it can only add function extensions within a single app.
  • Installation

    $ npm install homebrew

    For now, maybe you want to install different node version on one operating system, then "nvm" will help you solve this problem.

    https://github.com/creationix/nvm/blob/master/README.md

    you can use bellow command to check node version or other nvm commands

    nvm --help
    Usage:
      nvm --help                                Show this message
      nvm --version                             Print out the installed version of nvm
      nvm install [-s] <version>                Download and install a <version>, [-s] from source. Uses .nvmrc if available
        --reinstall-packages-from=<version>     When installing, reinstall packages installed in <node|iojs|node version number>
        --lts                                   When installing, only select from LTS (long-term support) versions
        --lts=<LTS name>                        When installing, only select from versions for a specific LTS line
        --skip-default-packages                 When installing, skip the default-packages file if it exists
        --latest-npm                            After installing, attempt to upgrade to the latest working npm on the given node version
      nvm uninstall <version>                   Uninstall a version
      nvm uninstall --lts                       Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.
      nvm uninstall --lts=<LTS name>            Uninstall using automatic alias for provided LTS line, if available.
      nvm use [--silent] <version>              Modify PATH to use <version>. Uses .nvmrc if available
        --lts                                   Uses automatic LTS (long-term support) alias `lts/*`, if available.
        --lts=<LTS name>                        Uses automatic alias for provided LTS line, if available.
      nvm exec [--silent] <version> [<command>] Run <command> on <version>. Uses .nvmrc if available
        --lts                                   Uses automatic LTS (long-term support) alias `lts/*`, if available.
        --lts=<LTS name>                        Uses automatic alias for provided LTS line, if available.
      nvm run [--silent] <version> [<args>]     Run `node` on <version> with <args> as arguments. Uses .nvmrc if available
        --lts                                   Uses automatic LTS (long-term support) alias `lts/*`, if available.
        --lts=<LTS name>                        Uses automatic alias for provided LTS line, if available.
      nvm current                               Display currently activated version
      nvm ls                                    List installed versions
      nvm ls <version>                          List versions matching a given <version>
      nvm ls-remote                             List remote versions available for install
        --lts                                   When listing, only show LTS (long-term support) versions
      nvm ls-remote <version>                   List remote versions available for install, matching a given <version>
        --lts                                   When listing, only show LTS (long-term support) versions
        --lts=<LTS name>                        When listing, only show versions for a specific LTS line
      nvm version <version>                     Resolve the given description to a single local version
      nvm version-remote <version>              Resolve the given description to a single remote version
        --lts                                   When listing, only select from LTS (long-term support) versions
        --lts=<LTS name>                        When listing, only select from versions for a specific LTS line
      nvm deactivate                            Undo effects of `nvm` on current shell
      nvm alias [<pattern>]                     Show all aliases beginning with <pattern>
      nvm alias <name> <version>                Set an alias named <name> pointing to <version>
      nvm unalias <name>                        Deletes the alias named <name>

原文地址:https://www.cnblogs.com/juliazhang/p/9480526.html

时间: 2024-10-19 16:56:23

Install Different Node Version on Mac的相关文章

How do you install mysql-connector-python (development version) through pip?

12down votefavorite 8 http://stackoverflow.com/questions/31748278/how-do-you-install-mysql-connector-python-development-version-through-pip/34027037#34027037 I have a virtualenv in which I am running Django 1.8 with Python 3.4 I am trying to get supp

Install mcrypt for php on Mac OSX 10.10 Yosemite for a Development Server

mcrypt is a file encryption method using secure techniques to exchange data. It is required for some web apps for example Magento, the shopping cart software or a php framework like Laravel. This tutorial has been tested in OSX 10.10 Yosemite. This g

how to install an older version of package via NuGet?

转载 http://stackoverflow.com/questions/10206090/how-to-install-an-older-version-of-package-via-nuget ry the following: Uninstall-Package Newtonsoft.Json -Force followed by: Install-Package Newtonsoft.Json -Version <press tab key for autocomplete> twi

【Node.js】Mac 下安装node图文详解

1  进入官网,下载node最新版 官网:https://nodejs.org/en/ 2 双击下载的安装包,一路默认安装就行 3  打开终端,输入以下命令查看结果,如出现下图信息则为安装成功 4   新建一个js 文件 : nodetest.js   ,输入下面的代码并保存 var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, { &quo

Silverlight无法启动调试,错误“Unable to start debugging. The Silverlight Developer Runtime is not installed. Please install a matching version.” 解决办法

今天调试Silverlight出现了以下错误: 意思是“无法启动调试,因为Silverlight Developer Runtime没有安装,请安装一个匹配的版本”.但是按Ctrl + F5可以调试运行,不对啊,前几天还好好的,今天怎么就不行了呢? 突然想起来,前几天Silverlight升级了,于是卸载Silverlight SDK重装,还是有这个错误.下面给出解决办法: 卸载Microsoft Silverlight 然后重装Silverlight4_Tools.exe,或者解压Silver

linux Install nvm, node.js, and npm

https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2#install-nvm-nodejs-and-npm https://help.aliyun.com/document_detail/50775.html 原文地址:https://www.cnblogs.com/wswind/p/11756116.html

linux 下安装 node 报: command not found

sudo yum install epel-release sudo yum install nodejs node --version 原文地址:https://www.cnblogs.com/daicw/p/11518830.html

解决 linux 下安装 node 报: command not found

注意:有时安装成功后,需要关闭xshell,重新启动.nvm才会生效. 1. 在 linux 下安装 node 提示 -bash:  node: command not found. 2. 这种情况可以用 epel 的来安装 node : sudo yum install epel-release    sudo yum install nodejs    node --version 输出版本信息就证明装成功了. 3. 安装 npm 和 express: sudo yum install np

如何在CentOS7上部署Ghost博客系统

目录 准备工作 新建用户 安装Nginx服务 将端口添加到防火墙里或者关闭防火墙 安装MySql5.7 安装官方的Ghost工具ghost-cli 网站目录准备,此目录必须为空目录 安装Ghost 启动ghost Nginx的反向代理配置 CentOS版本 CentOS-7-x86_64-DVD-1810 Ghost版本 2.23.4 本文以下所有操作和命令均是根据官网setup说明进行,官网仅针对Ubuntu有安装说明,没有在CentOS里的安装说明,网上能Google或Baidu到的所有文章