前端的每周一结之六

一.前端新手的常见错误
1.滥用this
this在vue中主要指向global,而that会存储指向;
你可能会发现别人写的代码中有这么一句:var that = this;,这代表什么意思呢?
在javascript中,this代表的是当前对象。
var that=this就是将当前的this对象复制一份到that变量中。这样做有什么意义呢?

$(‘#zhetenga’).click(function(){
//this是被点击的#zhetenga
var that = this;

$(‘.zhetenga’).each(function(){

//this是.zhetenga循环中当前的对象
//that仍然是刚才被点击的#zhetenga
});
});
可以看到,this对象在程序中随时会改变,而var that=this之后,that没改变之前仍然是指向当时的this,这样就不会出现找不到原来的对象。
https://blog.csdn.net/a297487901/article/details/78234420
2 . created和mounted的问题
a.created是模板渲染成html前调用,主要是为了处理数据
b.mounted是目标渲染成html后调用,主要是为了处理节点
c.在vue中,进入某个组件需要自调用的函数应该用mounted,而不是created
https://blog.csdn.net/oqqaKun1/article/details/81064728
3. mint-ui中图片不显示的问题
需要使用require(…/assets/img/1.jpg)
https://blog.csdn.net/weixin_34197488/article/details/88655976

二.将vue打包好的文件部署到http-server中
1.背景,一个pc端的后台管理项目;服务器ip由公司提供

2.下载好putty和winSCP(关于pm2的用法请大家自行网上寻找)

3.遵循以下命令
login as: root
root@#######'s password:
Last login: Fri Aug 9 20:41:20 2019 from 125.71.79.147

Welcome to Alibaba Cloud Elastic Compute Service !

[root@izwz97c1c7somo45uj0tqrz ~]# yum
Loaded plugins: fastestmirror
You need to give some command
Usage: yum [options] COMMAND

List of Commands:

check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package’s dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase Remove a package or packages from your system
fs Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.
fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots.
groups Display, or use, the groups information
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them
repolist Display the configured software repositories
search Search package details for the given string
shell Run an interactive yum shell
swap Simple way to swap packages, instead of using shell
update Update a package or packages on your system
update-minimal Works like upgrade, but goes to the ‘newest’ package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.

Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C, --cacheonly run entirely from system cache, don’t update cache
-c [config file], --config=[config file]
config file location
-R [minutes], --randomwait=[minutes]
maximum command wait time
-d [debug level], --debuglevel=[debug level]
debugging output level
–showduplicates show duplicates, in repos, in list/search commands
-e [error level], --errorlevel=[error level]
error output level
–rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet quiet operation
-v, --verbose verbose operation
-y, --assumeyes answer yes for all questions
–assumeno answer no for all questions
–version show Yum version and exit
–installroot=[path] set install root
–enablerepo=[repo] enable one or more repositories (wildcards allowed)
–disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
–disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
–disableincludes=[repo]
disable includepkgs for a repo or for everything
–obsoletes enable obsoletes processing during updates
–noplugins disable Yum plugins
–nogpgcheck disable gpg signature checking
–disableplugin=[plugin]
disable plugins by name
–enableplugin=[plugin]
enable plugins by name
–skip-broken skip packages with depsolving problems
–color=COLOR control whether color is used
–releasever=RELEASEVER
set value of $releasever in yum config and repo files
–downloadonly don’t update, just download
–downloaddir=DLDIR specifies an alternate directory to store packages
–setopt=SETOPTS set arbitrary config and repo options
–bugfix Include bugfix relevant packages, in updates
–security Include security relevant packages, in updates
–advisory=ADVS, --advisories=ADVS
Include packages needed to fix the given advisory, in
updates
–bzs=BZS Include packages needed to fix the given BZ, in
updates
–cves=CVES Include packages needed to fix the given CVE, in
updates
–sec-severity=SEVS, --secseverity=SEVS
Include security relevant packages matching the
severity, in updates

Plugin Options:
[root@izwz97c1c7somo45uj0tqrz ~]# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13226 100 13226 0 0 1796 0 0:00:07 0:00:07 --:–:-- 3225
=> nvm is already installed in /root/.nvm, trying to update the script

=> 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:

/root/.nvm/versions/node/v10.16.2/lib
├── [email protected]
=> 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=“ H O M E / . n v m " [ − s " HOME/.nvm" [ -s " HOME/.nvm"[s"NVM_DIR/nvm.sh” ] && . “KaTeX parse error: Expected 'EOF', got '#' at position 18: …M_DIR/nvm.sh" #̲ This loads nvm…NVM_DIR/bash_completion” ] && . “$NVM_DIR/bash_completion” # This loads nvm bash_completion
[root@izwz97c1c7somo45uj0tqrz ~]# source /root/.bashrc
[root@izwz97c1c7somo45uj0tqrz ~]# nvm

Node Version Manager

Note: refers to any version-like string nvm understands. This includes:

  • full or partial version numbers, starting with an optional “v” (0.10, v0.1.2, v1)
  • default (built-in) aliases: node, stable, unstable, iojs, system
  • custom aliases you define with nvm alias foo

Any options that produce colorized output should respect the --no-colors option.

Usage:
nvm --help Show this message
nvm --version Print out the installed version of nvm
nvm install [-s] Download and install a , [-s] from source. Uses .nvmrc if available
–reinstall-packages-from= When installing, reinstall packages installed in
–lts When installing, only select from LTS (long-term support) versions
–lts= 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
–no-progress Disable the progress bar on any downloads
nvm uninstall Uninstall a version
nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias lts/*, if available.
nvm uninstall --lts= Uninstall using automatic alias for provided LTS line, if available.
nvm use [–silent] Modify PATH to use . Uses .nvmrc if available
–lts Uses automatic LTS (long-term support) alias lts/*, if available.
–lts= Uses automatic alias for provided LTS line, if available.
nvm exec [–silent] [] Run on . Uses .nvmrc if available
–lts Uses automatic LTS (long-term support) alias lts/*, if available.
–lts= Uses automatic alias for provided LTS line, if available.
nvm run [–silent] [] Run node on with as arguments. Uses .nvmrc if available
–lts Uses automatic LTS (long-term support) alias lts/*, if available.
–lts= Uses automatic alias for provided LTS line, if available.
nvm current Display currently activated version of Node
nvm ls List installed versions
nvm ls List versions matching a given
nvm ls-remote List remote versions available for install
–lts When listing, only show LTS (long-term support) versions
nvm ls-remote List remote versions available for install, matching a given
–lts When listing, only show LTS (long-term support) versions
–lts= When listing, only show versions for a specific LTS line
nvm version Resolve the given description to a single local version
nvm version-remote Resolve the given description to a single remote version
–lts When listing, only select from LTS (long-term support) versions
–lts= When listing, only select from versions for a specific LTS line
nvm deactivate Undo effects of nvm on current shell
nvm alias [] Show all aliases beginning with
nvm alias Set an alias named pointing to
nvm unalias Deletes the alias named
nvm install-latest-npm Attempt to upgrade to the latest working npm on the current node version
nvm reinstall-packages Reinstall global npm packages contained in to current version
nvm unload Unload nvm from shell
nvm which [current | ] Display path to installed node version. Uses .nvmrc if available
nvm cache dir Display path to the cache directory for nvm
nvm cache clear Empty cache directory for nvm

Example:
nvm install 8.0.0 Install a specific version number
nvm use 8.0 Use the latest available 8.0.x release
nvm run 6.10.3 app.js Run app.js using node 6.10.3
nvm exec 4.8.3 node app.js Run node app.js with the PATH pointing to node 4.8.3
nvm alias default 8.1.0 Set default node version on a shell
nvm alias default node Always default to the latest available node version on a shell

Note:
to remove, delete, or uninstall nvm - just remove the $NVM_DIR folder (usually ~/.nvm)

[root@izwz97c1c7somo45uj0tqrz ~]# nvm install v10
v10.16.2 is already installed.
Now using node v10.16.2 (npm v6.9.0)
[root@izwz97c1c7somo45uj0tqrz ~]# npm install -g http-server
/root/.nvm/versions/node/v10.16.2/bin/http-server -> /root/.nvm/versions/node/v10.16.2/lib/node_modules/http-server/bin/http-server
/root/.nvm/versions/node/v10.16.2/bin/hs -> /root/.nvm/versions/node/v10.16.2/lib/node_modules/http-server/bin/http-server

  • [email protected]
    updated 1 package in 7.668s
    [root@izwz97c1c7somo45uj0tqrz ~]# cd mobile-dist/
    [root@izwz97c1c7somo45uj0tqrz mobile-dist]# ls
    css favicon.ico img index.html js
    [root@izwz97c1c7somo45uj0tqrz mobile-dist]# cd pc-dist/
    -bash: cd: pc-dist/: No such file or directory
    [root@izwz97c1c7somo45uj0tqrz mobile-dist]# ls
    css favicon.ico img index.html js
    [root@izwz97c1c7somo45uj0tqrz mobile-dist]# cd
    [root@izwz97c1c7somo45uj0tqrz ~]# cd pc-dist/
    [root@izwz97c1c7somo45uj0tqrz pc-dist]# ls
    favicon.ico index.html precache-manifest.e5372858c062be7a7f7560316633e156.js service-worker.js
    img manifest.json robots.txt static
    [root@izwz97c1c7somo45uj0tqrz pc-dist]# http-server -p 8083
    Starting up http-server, serving ./
    Available on:
    http://127.0.0.1:8083
    http://172.18.40.3:8083
    http://172.17.0.1:8083
    Hit CTRL-C to stop the server
    [Fri Aug 09 2019 20:55:58 GMT+0800 (China Standard Time)] “GET /” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:55:58 GMT+0800 (China Standard Time)] “GET /static/css/chunk-vendors.86734b30.css” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:55:58 GMT+0800 (China Standard Time)] “GET /static/css/index.f5f066d1.css” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:55:58 GMT+0800 (China Standard Time)] “GET /static/js/chunk-vendors.ead6ff6a.js” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:55:58 GMT+0800 (China Standard Time)] “GET /static/js/index.d58dda38.js” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:03 GMT+0800 (China Standard Time)] “GET /img/icons/favicon-32x32.png” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:03 GMT+0800 (China Standard Time)] “GET /img/icons/favicon-32x32.png” Error (404): “Not found”
    [Fri Aug 09 2019 20:56:03 GMT+0800 (China Standard Time)] “GET /img/icons/favicon-16x16.png” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:03 GMT+0800 (China Standard Time)] “GET /img/icons/favicon-16x16.png” Error (404): “Not found”
    [Fri Aug 09 2019 20:56:07 GMT+0800 (China Standard Time)] “GET /” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:09 GMT+0800 (China Standard Time)] “GET /” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:10 GMT+0800 (China Standard Time)] “GET /” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:20 GMT+0800 (China Standard Time)] “GET /” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:25 GMT+0800 (China Standard Time)] “GET /static/img/left.2436da48.png” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:25 GMT+0800 (China Standard Time)] “GET /static/img/school.b39935e9.png” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [Fri Aug 09 2019 20:56:25 GMT+0800 (China Standard Time)] “GET /static/fonts/element-icons.535877f5.woff” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”
    [root@izwz97c1c7somo45uj0tqrz ~]# pm2 list
    ┌───────────┬────┬──────┬────────┬───┬──────┬───────────┐
    │ Name │ id │ mode │ status │ ↺ │ cpu │ memory │
    ├───────────┼────┼──────┼────────┼───┼──────┼───────────┤
    │ qiangpiao │ 0 │ fork │ online │ 0 │ 0.2% │ 29.1 MB │
    └───────────┴────┴──────┴────────┴───┴──────┴───────────┘
    Use pm2 show to get more details about an app
    [root@izwz97c1c7somo45uj0tqrz ~]# pm2 log
    [TAILING] Tailing last 15 lines for [all] processes (change the value with --lin es option)
    /root/.pm2/pm2.log last 15 lines:
    PM2 | 2019-08-16T18:58:12: PM2 log: Time : Fri Aug 16 201 9 18:58:12 GMT+0800 (China Standard Time)
    PM2 | 2019-08-16T18:58:12: PM2 log: PM2 version : 3.5.1
    PM2 | 2019-08-16T18:58:12: PM2 log: Node.js version : 10.16.3
    PM2 | 2019-08-16T18:58:12: PM2 log: Current arch : x64
    PM2 | 2019-08-16T18:58:12: PM2 log: PM2 home : /root/.pm2
    PM2 | 2019-08-16T18:58:12: PM2 log: PM2 PID file : /root/.pm2/pm2 .pid
    PM2 | 2019-08-16T18:58:12: PM2 log: RPC socket file : /root/.pm2/rpc .sock
    PM2 | 2019-08-16T18:58:12: PM2 log: BUS socket file : /root/.pm2/pub .sock
    PM2 | 2019-08-16T18:58:12: PM2 log: Application log path : /root/.pm2/log s
    PM2 | 2019-08-16T18:58:12: PM2 log: Process dump file : /root/.pm2/dum p.pm2
    PM2 | 2019-08-16T18:58:12: PM2 log: Concurrent actions : 2
    PM2 | 2019-08-16T18:58:12: PM2 log: SIGTERM timeout : 1600
    PM2 | 2019-08-16T18:58:12: PM2 log: ===================================== ==========================================
    PM2 | 2019-08-16T18:58:12: PM2 log: App [qiangpiao:0] starting in -fork m ode-
    PM2 | 2019-08-16T18:58:12: PM2 log: App [qiangpiao:0] online

/root/.pm2/logs/qiangpiao-error.log last 15 lines:
/root/.pm2/logs/qiangpiao-out.log last 15 lines:
0|qiangpia | Starting up http-server, serving /root/mobile-dist/
0|qiangpia | Available on:
0|qiangpia | http://127.0.0.1:8082
0|qiangpia | http://172.18.40.3:8082
0|qiangpia | Hit CTRL-C to stop the server
0|qiangpia | [Fri Aug 16 2019 18:58:13 GMT+0800 (China Standard Time)] “GET /” " Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHT ML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
0|qiangpia | [Fri Aug 16 2019 18:58:14 GMT+0800 (China Standard Time)] “GET /fav icon.ico” “Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/60 4.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1”
0|qiangpia | [Fri Aug 16 2019 18:58:16 GMT+0800 (China Standard Time)] “GET /” " Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHT ML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
0|qiangpia | [Fri Aug 16 2019 18:58:16 GMT+0800 (China Standard Time)] “GET /fav icon.ico” “Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/60 4.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1”
0|qiangpia | [Fri Aug 16 2019 18:58:16 GMT+0800 (China Standard Time)] “GET /” " Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHT ML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
0|qiangpia | [Fri Aug 16 2019 18:58:17 GMT+0800 (China Standard Time)] “GET /fav icon.ico” “Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/60 4.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1”
0|qiangpia | [Fri Aug 16 2019 19:14:23 GMT+0800 (China Standard Time)] “GET /” " Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHT ML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
0|qiangpia | [Fri Aug 16 2019 19:14:23 GMT+0800 (China Standard Time)] “GET /fav icon.ico” “Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/60 4.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1”

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

这是大佬写的
login as: root
root@#####'s password:
Last failed login: Fri Aug 9 18:34:44 CST 2019 from 125.71.79.147 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Fri Aug 9 17:02:17 2019 from 125.71.79.147

Welcome to Alibaba Cloud Elastic Compute Service !

[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]# apt
-bash: apt: command not found
[root@izwz97c1c7somo45uj0tqrz ~]# yum
Loaded plugins: fastestmirror
You need to give some command
Usage: yum [options] COMMAND

List of Commands:

check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package’s dependencies
distribution-synchronization Synchronize installed packages to the latest availa ble versions
downgrade downgrade a package
erase Remove a package or packages from your system
fs Acts on the filesystem data of the host, mainly for removing docs /lanuages for minimal hosts.
fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots.
groups Display, or use, the groups information
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repo-pkgs Treat a repo. as a group of packages, so we can install/remove al l of them
repolist Display the configured software repositories
search Search package details for the given string
shell Run an interactive yum shell
swap Simple way to swap packages, instead of using shell
update Update a package or packages on your system
update-minimal Works like upgrade, but goes to the ‘newest’ package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.

Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C, --cacheonly run entirely from system cache, don’t update cache
-c [config file], --config=[config file]
config file location
-R [minutes], --randomwait=[minutes]
maximum command wait time
-d [debug level], --debuglevel=[debug level]
debugging output level
–showduplicates show duplicates, in repos, in list/search commands
-e [error level], --errorlevel=[error level]
error output level
–rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet quiet operation
-v, --verbose verbose operation
-y, --assumeyes answer yes for all questions
–assumeno answer no for all questions
–version show Yum version and exit
–installroot=[path] set install root
–enablerepo=[repo] enable one or more repositories (wildcards allowed)
–disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
–disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
–disableincludes=[repo]
disable includepkgs for a repo or for everything
–obsoletes enable obsoletes processing during updates
–noplugins disable Yum plugins
–nogpgcheck disable gpg signature checking
–disableplugin=[plugin]
disable plugins by name
–enableplugin=[plugin]
enable plugins by name
–skip-broken skip packages with depsolving problems
–color=COLOR control whether color is used
–releasever=RELEASEVER
set value of $releasever in yum config and repo files
–downloadonly don’t update, just download
–downloaddir=DLDIR specifies an alternate directory to store packages
–setopt=SETOPTS set arbitrary config and repo options
–bugfix Include bugfix relevant packages, in updates
–security Include security relevant packages, in updates
–advisory=ADVS, --advisories=ADVS
Include packages needed to fix the given advisory, in
updates
–bzs=BZS Include packages needed to fix the given BZ, in
updates
–cves=CVES Include packages needed to fix the given CVE, in
updates
–sec-severity=SEVS, --secseverity=SEVS
Include security relevant packages matching the
severity, in updates

Plugin Options:
[root@izwz97c1c7somo45uj0tqrz ~]# yum install node
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
docker-ce-stable | 3.5 kB 00:00
epel | 5.3 kB 00:00
extras | 3.4 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql80-community | 2.5 kB 00:00
updates | 3.4 kB 00:00
Loading mirror speeds from cached hostfile
No package node available.
Error: Nothing to do
[root@izwz97c1c7somo45uj0tqrz ~]# nvm
-bash: nvm: command not found
[root@izwz97c1c7somo45uj0tqrz ~]# curl -o- https://raw.githubusercontent.com/nvm -sh/nvm/v0.34.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13226 100 13226 0 0 5139 0 0:00:02 0:00:02 --:–:-- 5138
=> Downloading nvm as script to ‘/root/.nvm’

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR=“ H O M E / . n v m " [ − s " HOME/.nvm" [ -s " HOME/.nvm"[s"NVM_DIR/nvm.sh” ] && . “KaTeX parse error: Expected 'EOF', got '#' at position 18: …M_DIR/nvm.sh" #̲ This loads nvm…NVM_DIR/bash_completion” ] && . “$NVM_DIR/bash_completion” # This loads nvm bash_completion
[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]#
[root@izwz97c1c7somo45uj0tqrz ~]# nvm
-bash: nvm: command not found
[root@izwz97c1c7somo45uj0tqrz ~]# source /root/.bashrc
[root@izwz97c1c7somo45uj0tqrz ~]# nvm

Node Version Manager

Note: refers to any version-like string nvm understands. This includes:

  • full or partial version numbers, starting with an optional “v” (0.10, v0.1.2, v1)
  • default (built-in) aliases: node, stable, unstable, iojs, system
  • custom aliases you define with nvm alias foo

Any options that produce colorized output should respect the --no-colors option.

Usage:
nvm --help Show this message
nvm --version Print out the installed version of nvm
nvm install [-s] Download and install a , [-s] from source. Uses .nvmrc if avai
–reinstall-packages-from= When installing, reinstall packages installed in –lts When installing, only select from LTS (long-term support) versions
–lts= 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 g
–no-progress Disable the progress bar on any downloads
nvm uninstall Uninstall a version
nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias lts/*, if ava
nvm uninstall --lts= Uninstall using automatic alias for provided LTS line, if available.
nvm use [–silent] Modify PATH to use . Uses .nvmrc if available
–lts Uses automatic LTS (long-term support) alias lts/*, if available.
–lts= Uses automatic alias for provided LTS line, if available.
nvm exec [–silent] [] Run on . Uses .nvmrc if available
–lts Uses automatic LTS (long-term support) alias lts/*, if available.
–lts= Uses automatic alias for provided LTS line, if available.
nvm run [–silent] [] Run node on with as arguments. Uses .nvmrc if availa
–lts Uses automatic LTS (long-term support) alias lts/*, if available.
–lts= Uses automatic alias for provided LTS line, if available.
nvm current Display currently activated version of Node
nvm ls List installed versions
nvm ls List versions matching a given
nvm ls-remote List remote versions available for install
–lts When listing, only show LTS (long-term support) versions
nvm ls-remote List remote versions available for install, matching a given
–lts When listing, only show LTS (long-term support) versions
–lts= When listing, only show versions for a specific LTS line
nvm version Resolve the given description to a single local version
nvm version-remote Resolve the given description to a single remote version
–lts When listing, only select from LTS (long-term support) versions
–lts= When listing, only select from versions for a specific LTS line
nvm deactivate Undo effects of nvm on current shell
nvm alias [] Show all aliases beginning with
nvm alias Set an alias named pointing to
nvm unalias Deletes the alias named
nvm install-latest-npm Attempt to upgrade to the latest working npm on the current node vers
nvm reinstall-packages Reinstall global npm packages contained in to current versi
nvm unload Unload nvm from shell
nvm which [current | ] Display path to installed node version. Uses .nvmrc if available
nvm cache dir Display path to the cache directory for nvm
nvm cache clear Empty cache directory for nvm

Example:
nvm install 8.0.0 Install a specific version number
nvm use 8.0 Use the latest available 8.0.x release
nvm run 6.10.3 app.js Run app.js using node 6.10.3
nvm exec 4.8.3 node app.js Run node app.js with the PATH pointing to node 4.8.3
nvm alias default 8.1.0 Set default node version on a shell
nvm alias default node Always default to the latest available node version on a shell

Note:
to remove, delete, or uninstall nvm - just remove the $NVM_DIR folder (usually ~/.nvm)

[root@izwz97c1c7somo45uj0tqrz ~]# nvm install v10
Downloading and installing node v10.16.2…
Downloading https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-x64.tar.xz…
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v10.16.2 (npm v6.9.0)
Creating default alias: default -> v10 (-> v10.16.2)
[root@izwz97c1c7somo45uj0tqrz ~]# npm install -g http-server
/root/.nvm/versions/node/v10.16.2/bin/http-server -> /root/.nvm/versions/node/v10.16.2/lib/node_modules/http-server
/root/.nvm/versions/node/v10.16.2/bin/hs -> /root/.nvm/versions/node/v10.16.2/lib/node_modules/http-server/bin/http

  • [email protected]
    added 26 packages from 28 contributors in 12.106s
    [root@izwz97c1c7somo45uj0tqrz ~]# cd mobile-dist/
    [root@izwz97c1c7somo45uj0tqrz mobile-dist]# ls
    css favicon.ico img index.html js
    [root@izwz97c1c7somo45uj0tqrz mobile-dist]# http-server -p 8082
    Starting up http-server, serving ./
    Available on:
    http://127.0.0.1:8082
    http://172.18.40.3:8082
    http://172.17.0.1:8082
    Hit CTRL-C to stop the server
    [Fri Aug 09 2019 18:40:13 GMT+0800 (China Standard Time)] “GET /” "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWe
    [Fri Aug 09 2019 18:40:13 GMT+0800 (China Standard Time)] “GET /css/app.43944ccd.css” "Mozilla/5.0 (Windows NT 6.1;
    [Fri Aug 09 2019 18:40:13 GMT+0800 (China Standard Time)] “GET /css/chunk-vendors.779f7d1d.css” "Mozilla/5.0 (Windo
    [Fri Aug 09 2019 18:40:13 GMT+0800 (China Standard Time)] “GET /js/app.c47af2d6.js” "Mozilla/5.0 (Windows NT 6.1; W
    [Fri Aug 09 2019 18:40:13 GMT+0800 (China Standard Time)] “GET /js/chunk-vendors.1070d04f.js” "Mozilla/5.0 (Windows
    [Fri Aug 09 2019 18:40:15 GMT+0800 (China Standard Time)] “POST /user/login” "Mozilla/5.0 (Windows NT 6.1; Win64; x
    [Fri Aug 09 2019 18:40:15 GMT+0800 (China Standard Time)] “POST /user/login” Error (404): “Not found”
    [Fri Aug 09 2019 18:40:15 GMT+0800 (China Standard Time)] “GET /img/2.1cb5f44a.png” "Mozilla/5.0 (Windows NT 6.1; W
    [Fri Aug 09 2019 18:40:15 GMT+0800 (China Standard Time)] “GET /favicon.ico” "Mozilla/5.0 (Windows NT 6.1; Win64; x
    [Fri Aug 09 2019 18:40:16 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” "Mozilla/5.0 (Windows NT 6.
    [Fri Aug 09 2019 18:40:16 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” Error (404): “Not found”
    [Fri Aug 09 2019 18:40:20 GMT+0800 (China Standard Time)] “GET /img/4.8dd01164.png” "Mozilla/5.0 (Windows NT 6.1; W
    [Fri Aug 09 2019 18:40:21 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” "Mozilla/5.0 (Windows NT 6.
    [Fri Aug 09 2019 18:40:21 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” Error (404): “Not found”
    [Fri Aug 09 2019 18:40:22 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” "Mozilla/5.0 (Windows NT 6.
    [Fri Aug 09 2019 18:40:22 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” Error (404): “Not found”
    [Fri Aug 09 2019 18:40:27 GMT+0800 (China Standard Time)] “POST /user/login” "Mozilla/5.0 (Windows NT 6.1; Win64; x
    [Fri Aug 09 2019 18:40:27 GMT+0800 (China Standard Time)] “POST /user/login” Error (404): “Not found”
    [Fri Aug 09 2019 18:40:28 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” "Mozilla/5.0 (Windows NT 6.
    [Fri Aug 09 2019 18:40:28 GMT+0800 (China Standard Time)] “POST /api/user/messageLists” Error (404): “Not found”
    [Fri Aug 09 2019 18:40:35 GMT+0800 (China Standard Time)] “GET /img/5.32ba4a61.png” "Mozilla/5.0 (Windows NT 6.1; W

你可能感兴趣的:(前端的每周一结之六)