错误 发生意外错误:"Commit hash required"



当我使用此命令添加esint(@vue/cli 4.5.15(时:

vue add eslint

显示如下错误:

WARN  There are uncommitted changes in the current repository, it's recommended to commit or stash them first.
? Still proceed? Yes
📦  Installing @vue/cli-plugin-eslint...
yarn add v1.22.17
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
info If you think this is a bug, please open a bug report with the information provided in "/Users/xiaoqiangjiang/source/reddwarf/frontend/crx-selection-translate/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error An unexpected error occurred: "Commit hash required".
ERROR  command failed: yarn add @vue/cli-plugin-eslint@~4.5.0 -D

我该怎么办才能解决这个问题?我已经尝试删除锁定文件,但仍然没有解决此问题。节点版本为CCD_ 2。

当您在yarn项目中使用npm install,然后在意识到npm不起作用时使用yarn install时,通常会发生这种情况。不知怎的yarn.lock被破坏了。我是这样做的:

rm package-lock.json
rm yarn.lock
git checkout <old-hash> yarn.lock

对我来说,我做了以下事情,它很有效:

$ rm package-lock.json    # remove the package-lock.json file
$ yarn install  # install successfully and update the yarn.lock file

相关内容

最新更新