pm2 ls
pm2 stop 项目名
pm2 start app.js --name 项目名
pm2 logs
error An unexpected error occurred: "https://registry.npmmirror.com/bcryptjs/-/bcryptjs-2.4.3.tgz: self signed certificate in certificate chain".
info If you think this is a bug, please open a bug report with the information provided in "/var/local/xxx/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn config set "strict-ssl" false -g
error /var/local/xxxxx/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: /var/local/xxxxxxxx/node_modules/sharp
Output:
npm config set python=/usr/bin/python2.7
yarn config set python "/usr/bin/python2.7"
npm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
解决sharp太慢、失败Could not load strapi-server.js, pmSomething went wrong installing the “sharp“ module
多种方案解决前端安装sharp出错问题sharp: Command failed.
# 进入根路径
[serverName ~]$ cd /
# 查看文件列表
[serverName /]$ ls
bin boot conf data dev docker-data etc home lib lib64 media mnt opt plugins proc root run sbin srv storage sys tmp usr var
# 想要进入某个路径,发现没有权限
[serverName /]$ cd var/local/xxxxxx/
-bash: cd: var/local/xxxxxx/: Permission denied
# 开启权限
[serverName /]$ sudo su
[sudo] password for XXXXXX_USER_01:
[root@serverName /]# cd var/local/xxxxxx/
[root@serverName xxxxxx]# ls
xxxxxx-uat-2 yarn.lock
# 删除某个文件(yarn.lock)
[root@serverName xxxxxx]# rm -rf yarn.lock
[root@serverName xxxxxx]# ls
xxxxxx-uat-2
# 设置python
[root@serverName xxxxxx]# cd xxxxxx-uat-2/
[root@serverName xxxxxx-uat-2]# yarn config set python "/usr/lib64/python2.7"
yarn config v1.22.18
success Set "python" to "/usr/lib64/python2.7".
Done in 0.04s.
[root@serverName xxxxxx-uat-2]# yarn install
# 开启权限,输入密码
[serverName /]$ sudo su
[sudo] password for XXXXXX_USER_01:
[root@servername var]# cd local
# mkdir 命令是 Linux操作系统中的一个基本工具,用于在文件系统中创建新的目录
[root@servername local]# mkdir uat-path
# mv 命令(move 的缩写),既可以在不同的目录之间移动文件或目录,也可以对文件和目录进行重命名。该命令的基本格式如下:
# 使用规则:mv 【选项】 源文件 目标文件
[root@servername local]# mv /home/path_01/td/project-uat-2 ./
[root@servername local]# ls
uat-path project-uat-2
[root@servername local]# mv project-uat-2/ uat-path/
[root@servername local]# ls
uat-path
[root@servername local]# cd uat-path/
sudo chown -R USER_01:USER_01 /var
yarn config set NODE_TLS_REJECT_UNAUTHORIZED 0
举例:
[USER_01@servername /app]$ yarn config set NODE_TLS_REJECT_UNAUTHORIZED 0
yarn config v1.22.18
success Set "NODE_TLS_REJECT_UNAUTHORIZED" to "0".
Done in 0.04s.
PS C:\my_files\my-project> npm run deploy
> [email protected] deploy
> node deploy.js
Error: connect->getConnection: All configured authentication methods failed
at fmtError (C:\my_files\my-project\node_modules\ssh2-sftp-client\src\utils.js:55:18)
at SftpClient.connect (C:\my_files\my-project\node_modules\ssh2-sftp-client\src\index.js:217:13)
at async main (C:\my_files\my-project\deploy.js:16:5) {
code: 'ERR_GENERIC_CLIENT',
custom: true
}
undefined
C:\my_files\my-project\node_modules\ssh2-sftp-client\src\utils.js:55
let newError = new Error(msg);
^
Error: end: No SFTP connection available
at fmtError (C:\my_files\my-project\node_modules\ssh2-sftp-client\src\utils.js:55:18)
at haveConnection (C:\my_files\my-project\node_modules\ssh2-sftp-client\src\utils.js:311:20)
at C:\my_files\my-project\node_modules\ssh2-sftp-client\src\index.js:1314:11
at new Promise ()
at SftpClient.end (C:\my_files\my-project\node_modules\ssh2-sftp-client\src\index.js:1305:12)
at main (C:\my_files\my-project\deploy.js:25:12) {
code: 'ERR_NOT_CONNECTED',
custom: true
}
PS C:\my_files\my-project>
修改这个文件/etc/resolv.conf就可以配置DNS
/etc/resolv.conf是DNS客户机的配置文件,用于设置DNS服务器的IP地址及DNS域名
resolv.conf的关键字主要有4个,分别为:
cat /etc/resolv.conf
domain xxx.com
search www.xxx.com xxx.com
nameserver 111.112.112.11
nameserver 111.112.112.11
df -h 查看磁盘占用的空间
[xxxxx ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
aaaaaafs 3.9G 0 3.9G 0% /dev
aaaas 3.9G 0 3.9G 0% /dev/aaa
aaaas 3.9G 114M 3.8G 3% /run
aaaas 3.9G 0 3.9G 0% /sys/fs/cgroup
[xxxxxxxxxxx ~]$ free -m
total used free shared buff/cache available
Mem: 7821 3451 304 208 4065 3862
Swap: 9723 327 9396
Mem:内存的使用情况总览表。
total:表示物理,内存总量–机器总的物理内存 单位为:M
used:用掉的内存{ 总计分配给缓存(包含Buffer和cache)使用的数量,但其中可能部分缓存并未实际使用 }
free: 空闲的物理内存–未被分配的内存
shared:共享内存,一般系统不会用到,这里也不讨论
buffers:系统分配但未被使用的buffers数量
cached:系统分配但未被使用的cache数量
欢迎大家指出文章需要改正之处~
学无止境,合作共赢