要查看主要问题,请查看yarn.lock的代码段:
moment@<2.26.0:
version "2.25.3"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.25.3.tgz#252ff41319cf41e47761a1a88cab30edfe9808c0"
"moment@>= 2.9.0", moment@>=2.14.0, moment@^2.10.2, moment@^2.22.2, moment@^2.8.2, moment@^2.9.0:
version "2.26.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a"
我怎么到这里来?
node_modules
"moment": "2.24.0",
替换了"moment": "<2.26.0",
yarn install
现在执行yarn start
时,应用程序无法启动。我收到TS编译错误,这是由于混合不兼容的版本引起的:https://github.com/ant-design/ant-design/issues/24377
看起来像是TS依赖地狱。怎么解决呢?为什么会有2个具有不同版本的'moment'库?
如何解决?
手动合并两个条目
moment@<2.26.0, "moment@>= 2.9.0", moment@>=2.14.0, moment@^2.10.2, moment@^2.22.2, moment@^2.8.2, moment@^2.9.0:
version "2.25.3"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.25.3.tgz#252ff41319cf41e47761a1a88cab30edfe9808c0"
并运行yarn install