我用yarn add --dev安装了一个软件包,运行了它的安装过程,在安装过程中,软件包安装了其他几个软件包,并将它们添加到package.json(在devDependencies中),我假设是npm.很好,但现在我的yarn.lock不同步了.

yarn.lock同步到当前状态package.json的正确非手动方式是什么?

编辑:yarn check显示丢失的包,如下所示:

error Lockfile does not contain pattern: <package>@<version>

但这并没有增加它们.

推荐答案

yarn install,或者只跑yarn.

锁文件会在对依赖项进行任何更改时(即在运行命令时)全部更新.

Yarn docs人中:

你的故事.锁文件是自动生成的,应该完全由Yarn 处理.As you add/upgrade/remove dependencies with the Yarn CLI, it will automatically update your yarn.lock file.不要直接编辑这个文件,因为它很容易 destruct 某些东西.

(Emphasis my own)

Node.js相关问答推荐

安装样式组件时出现react 错误

连接到在线 redis 数据库时出错

nyc 代码覆盖不适用于 NodeJs Express 服务器

为什么 client.on("messageCreate") 的 TextChannel 中缺少 nsfw 属性?

无法使用 node 预签名 url 从 React 将图像文件上传到 s3

为什么当我try req.logout() 时出现此错误?

类 WebSwapCGLLayer 在 Mac OS X /System 和 node_modules 中都实现了

Node.js 变量声明和范围

使用 nvm-windows 时更新 npm

构建 vue cli 后如何运行生产站点

Node.js 服务器中没有缓存

如何在 Node.js 中等待子进程完成

使用 Webpack 和 font-face 加载字体

我可以在 Heroku 中运行咖啡脚本吗?

在 Jade 包含中使用变量

Mongoose:模式与模型?

react-native run-android 无法识别

node.js 异步库

promise 回调返回promise

如何修复此错误 TypeError [ERR_INVALID_CALLBACK]: Callback must be a function