【发布时间】:2021-06-13 14:06:48
【问题描述】:
重现步骤:
npm init
npm i react-syntax-highlighter
{
"dependencies": {
"react-syntax-highlighter": "^15.4.3"
}
}
我有最新版本,hourra!
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 i <package_name> 时,如何配置 NPM 以始终下载最新版本。基本上使@latest 成为默认行为(我认为这是默认行为)。
【问题讨论】:
标签: npm npm-install