美文网首页
web开发环境搭建

web开发环境搭建

作者: 土豆特别想爬山 | 来源:发表于2021-06-10 19:15 被阅读0次

    一、安装 nvm--node版本管理工具

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

    在配置文件(~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc)末尾添加下列内容:

    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
    

    刷新配置:

    bash: source ~/.bashrc
    zsh: source ~/.zshrc
    ksh: . ~/.profile
    

    用法:

    nvm install node         # "node" is an alias for the latest version
    nvm install 6.14.4      # or 10.10.0, 8.9.1, etc
    nvm ls-remote            # list available versions
    nvm use node            # use the installed version
    nvm run node --version    # run
    nvm which 5.0          # get the path to the executable to where it was installed
    

    安装后,通过nvm ls查看:

    nvm ls

    二、 安装nrm -- NPM registry manager

    npm install -g nrm 
    

    安装完成后执行 nrm ls:

    * npm ------- https://registry.npmjs.org/
      yarn ------ https://registry.yarnpkg.com
      tencent --- https://mirrors.cloud.tencent.com/npm/
      cnpm ------ http://r.cnpmjs.org/
      taobao ---- https://registry.npm.taobao.org/
      nj -------- https://registry.nodejitsu.com/
      skimdb ---- https://skimdb.npmjs.com/registry
    
    Usage: nrm [options] [command]
    
      Commands:
    
        ls                                    List all the registries
        current                               Show current registry name
        use <registry>                        Change registry to registry
        add <registry> <url> [home]           Add one custom registry
        login <registry> [value]              Set authorize information for a registry with a base64 encoded string or username and pasword
          -a  --always-auth                     Set is always auth
          -u  --username <username>             Your user name for this registry
          -p  --password <password>             Your password for this registry
          -e  --email <email>                   Your email for this registry
        set-hosted-repo <registry> <value>    Set hosted npm repository for a custom registry to publish packages
        set-scope <scopeName> <value>         Associating a scope with a registry
        del-scope <scopeName>                 Remove a scope
        set <registryName>                    Set custom registry attribute
          -a  --attr <attr>                    Set custorm registry attribute
          -v  --value <value>                  Set custorm registry value
        del <registry>                        Delete one custom registry
        rename <registryName> <newName>       Set custom registry name
        home <registry> [browser]             Open the homepage of registry with optional browser
        publish [<tarball>|<folder>]          Publish package to current registry if current registry is a custom registry. The field 'repository' of current custom registry is required running this command. If you're not using custom registry, this command will run npm publish directly
          -t  --tag [tag]                        Add tag
          -a  --access <public|restricted>       Set access
          -o  --otp [otpcode]                    Set otpcode
          -dr --dry-run                          Set is dry run
        test [registry]                       Show the response time for one or all registries
        help                                  Print this help
    
      Options:
    
        -h  --help     output usage information
        -V  --version  output the version number
    

    三、进入项目目录,安装依赖

    npm i
    

    相关文章

      网友评论

          本文标题:web开发环境搭建

          本文链接:https://www.haomeiwen.com/subject/ktdnrltx.html