错误一
yarn install
yarn install v1.22.22
[1/4] 🔍 Resolving packages...
info There appears to be trouble with your network connection. Retrying...
[2/4] 🚚 Fetching packages...
error Error: certificate has expired
at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
at TLSSocket.emit (node:events:520:28)
at TLSSocket._finishInit (node:_tls_wrap:1078:8)
at ssl.onhandshakedone (node:_tls_wrap:864:12)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
解决办法
将yarn配置中的 strict-ssl 设置为 flase , 在 info yarn config 信息中, 'strict-ssl' 为 true,表示需要验证 HTTPS 证书。我们可以将 'strict-ssl' 设置为 false,跳过 HTTPS 证书验证。
yarn config set "strict-ssl" false -g
错误二
yarn install
yarn install v1.22.22
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error Error: getaddrinfo ENOTFOUND registry.nlark.com
at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
info There appears to be trouble with your network connection. Retrying...
解决办法
出现了类似这种 error Error: getaddrinfo ENOTFOUND xxx 的情况就是说对应的xxx地址找不到或者失效了。 导致这个的原因可能是你的当前项目中的 yarn.lock文件中引用了一个已经失效的地址.
删除这个yarn.lock文件,重新执行yarn install
启动项目时候报错
错误提示babel/core版本不对
./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js
Error: [BABEL] /Users/imac/mywork/xtalk/node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js: Requires Babel "^7.16.0", but was loaded with "7.12.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing: "/Users/imac/mywork/xtalk/node_modules/babel-preset-react-app/dependencies.js$0$2")
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
at cachedFunction.next (<anonymous>)
at loadPluginDescriptor.next (<anonymous>)
at loadPluginDescriptors.next (<anonymous>)
at Generator.next (<anonymous>)
at loadFullConfig.next (<anonymous>)
^Cmake: *** [callcenter-start] Interrupt: 2
解决办法
降级caniuse-lite版本
yarn add caniuse-lite@1.0.30001632
修改package.json
For npm
"overrides": {
"caniuse-lite": "1.0.30001632"
},
For yarn
"resolutions": {
"caniuse-lite": "1.0.30001632"
},