0%

执行ionic start my-app --v2时出现以下错误:

1
2
3
Error with start undefined
Error Initializing app: There was an error with the spawned command: npminstall
There was an error with the spawned command: npminstall

这个错误是由于npm版本太旧造成的,执行以下命令:

1
npm install -g npm

查看路由表:

1
netstat -nr

删除路由:

1
2
route delete 0.0.0.0        # 删除默认路由
route delete 10.0.100.0 # 删除普通路由

添加路由:

1
2
route add -net 0.0.0.0 192.168.1.1          # 添加默认路由
route add 192.168.2.0/24 192.168.1.1 # 将192.168.2网段的网关设置为192.168.1.1

附:

全球IP段查询:http://ipblock.chacuo.net/

中国最新IP段:http://ipblock.chacuo.net/down/t_txt=c_CN

1
2
3
cnroute(){
command curl -s http://ipblock.chacuo.net/down/t_txt=c_CN | awk '{print $3}' | xargs -I {} sudo route add {} 192.168.1.1
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
apt-get update && apt-get install -y pptpd

cat <<EOF>> /etc/pptpd.conf
localip 192.168.17.1
remoteip 192.168.17.100-199
EOF

cat <<EOF>> /etc/ppp/pptpd-options
ms-dns 192.168.17.1
ms-dns 8.8.8.8
EOF

cat <<EOF>> /etc/ppp/chap-secrets
username * password *
EOF

systemctl enable pptpd
systemctl restart pptpd

echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.17.0/24 -o eth0 -j MASQUERADE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
version: '2'

services:
main:
image: redis:3.0
restart: always
networks:
- network_name

networks:
network_name:
driver: bridge
ipam:
config:
- subnet: 172.27.1.0/24

在profile(~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc)文件中添加:

1
ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/