重现步骤:
npm init
npm i react-syntax-highlighter
{
"dependencies": {
"react-syntax-highlighter": "^15.4.3"
}
}
我有最新版本,小时!
npm init
npm i @storybook/components
npm i react-syntax-highlighter
{
"dependencies": {
"@storybook/components": "^6.2.9",
"react-syntax-highlighter": "^13.5.3"
}
}
哇?我花了 2 小时和很多 luck 才发现我没有最新的 react-syntax-highlighter
包,似乎是因为 @storybook/components
使用 react-syntax-highlighter@13.5.3
。
我发现 npm i <package_name>
并不总是安装最新的,这完全不直观。为什么 NPM 是这样设计的?以及如何配置 NPM 以在执行 npm i <package_name>
时始终下载最新版本。基本上使 @latest
成为默认行为(我认为这是默认行为)。
答案 0 :(得分:0)