赞
踩
git clone https://gitee.com/mirrors/nvm
1.1在终端指定的文件夹下
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools$ git clone https://gitee.com/mirrors/nvm
- fatal: destination path 'nvm' already exists and is not an empty directory.
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools$ ls
- nvm
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools$ cd nvm
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ ls
- bash_completion CONTRIBUTING.md GOVERNANCE.md LICENSE.md nvm-exec package.json README.md ROADMAP.md update_test_mocks.sh
- CODE_OF_CONDUCT.md Dockerfile install.sh Makefile nvm.sh PROJECT_CHARTER.md rename_test.sh test
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$
进入nvm目录内执行安装命令
bash install.sh
根据执行安装命令后的提示继续执行提示内容:
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ sudo bash install.sh
- => nvm is already installed in /root/.nvm, trying to update using git
- => => Compressing and cleaning up git repository
-
- => nvm source string already in /root/.bashrc
- => bash_completion source string already in /root/.bashrc
- => You currently have modules installed globally with `npm`. These will no
- => longer be linked to the active version of Node when you install a new node
- => with `nvm`; and they may (depending on how you construct your `$PATH`)
- => override the binaries of modules installed with `nvm`:
-
- /usr/local/lib
- ├── corepack@0.10.0
- => If you wish to uninstall them at a later point (or re-install them under your
- => `nvm` Nodes), you can remove them from the system Node as follows:
-
- $ nvm use system
- $ npm uninstall -g a_module
-
- => Close and reopen your terminal to start using nvm or run the following to use it now:
-
- export NVM_DIR="$HOME/.nvm"
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ export NVM_DIR="$HOME/.nvm"
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ nvm --version
- 0.39.1
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$
通过nvm --version可以看到安装成功。
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ nvm ls
-
- -> system
- iojs -> N/A (default)
- node -> stable (-> N/A) (default)
- unstable -> N/A (default)
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ nvm install 16.13.1
- Downloading and installing node v16.13.1...
- Downloading https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz...
- ################################################################################################################################################################################################################ 100.0%
- Computing checksum with sha256sum
- Checksums matched!
- Now using node v16.13.1 (npm v8.1.2)
- Creating default alias: default -> 16.13.1 (-> v16.13.1)
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ nvm ls
- -> v16.13.1
- system
- default -> 16.13.1 (-> v16.13.1)
- iojs -> N/A (default)
- unstable -> N/A (default)
- node -> stable (-> v16.13.1) (default)
- stable -> 16.13 (-> v16.13.1) (default)
- lts/* -> lts/gallium (-> N/A)
- lts/argon -> v4.9.1 (-> N/A)
- lts/boron -> v6.17.1 (-> N/A)
- lts/carbon -> v8.17.0 (-> N/A)
- lts/dubnium -> v10.24.1 (-> N/A)
- lts/erbium -> v12.22.12 (-> N/A)
- lts/fermium -> v14.19.2 (-> N/A)
- lts/gallium -> v16.15.0 (-> N/A)
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ nvm use 16.13.1
- Now using node v16.13.1 (npm v8.1.2)
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$ node -v
- v16.13.1
- drc@iZwz91oq31508figapkas0Z:~/qiang/tools/nvm$
- nvm ls :列出所有已安装的 node 版本
-
- nvm ls-remote :列出所有远程服务器的版本(官方node version list)
-
- nvm list :列出所有已安装的 node 版本
-
- nvm list available :显示所有可下载的版本
-
- nvm install stable :安装最新版 node
-
- nvm install [node版本号] :安装指定版本 node
-
- nvm uninstall [node版本号] :删除已安装的指定版本
-
- nvm use [node版本号] :切换到指定版本 node
-
- nvm current :当前 node 版本
-
- nvm alias [别名] [node版本号] :给不同的版本号添加别名
-
- nvm unalias [别名] :删除已定义的别名
-
- nvm alias default [node版本号] :设置默认版本
5 live-server安装与使用
live-server是一个具有实时加载功能的小型服务器,可以使用它来破解html/css/javascript,但是不能用于部署最终站点。也就是说我们可以在项目中实时用live-server作为一个实时服务器实时查看开发的网页或项目效果。
使用live-server,首先需要安装它:
npm install -g live-server
安装失败权限问题可以在前面加sudo
然后在所在项目目录下,打开命令行工具,输入 live-server,回车就可以了(注意这里默认打开的是index.html)
默认端口号是8080,如果想用其他端口号可以在运行live-server的时候用--port的方式指定端口号。
live-server --port=9000
最后:
在静态文件目录front_end_pc下执行
live-server
live-server运行在8080端口下,可以通过127.0.0.1:8080来访问静态页面。
使用live-server报错 :按照这个文章上面的方式修改格式
https://www.cnblogs.com/luojiuzxy/p/10830497.html
然后重新运行就好了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。