执行命令查看你的配置
git config --global -l
fatal: unable to access 'https://github.com/xxxxxx.git/': OpenSSL SSL_read: Connection was reset, errno 10054
npm ERR!
npm ERR! exited with error code: 128
这个问题我真的很常见,clone一个项目,npm install下一个包,经常遇到...
以下命令根据配置按需执行
// 取消ssl验证
git config --global http.sslverify "false"
// 设置github使用https:// 来代替 git://
git config --global url."https://".insteadOf git://
// 绕过ssl
npm config set strict-ssl false
//从https或http设置注册表URL
npm config set registry="http://registry.npmjs.org/"
// 清除npm缓存
npm cache clean --force
// 清除npm缓存 npm@5
npm cache clear --force && npm install --no-shrinkwrap --update-binary
如果你没有任何与https代理相关的内容,例如https_proxy = ... 如果您有与https代理相关的内容,请将其从/.gitconfig文件中删除
如果开启了shadowsock代理,执行命令,手动配置一下git的代理即可
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
//http:// 也可以改成 sockets5:// ,区别在于: socks5不支持通过pubkey免密登录github,每次提交代码只能输入用户名和密码。http可以支持免密登录。
取消代理可执行
git config --global --unset http.proxy
git config --global --unset https.proxy
下载某个包,总是下载失败,可以将node_modules目录全部删除,再执行
// 清除npm缓存
npm cache clean --force
// 清除npm缓存 npm@5
npm cache clear --force && npm install --no-shrinkwrap --update-binary
再执行
npm install
???还不行?
建议删除 package-lock.json 重新执行以下操作
常见的版本前缀有
'^': 匹配大版本下最新发布的次一级版本, 比如^1.2.3,代表版本范围1.*.*
'~': 匹配大版本下最新发布的最小一级版本,比如~1.2.3,代表版本范围1.2.*
'>=&&<': 匹配大于等于或小于某个版本号的最新发布的版本
'*': 匹配最新发布的版本