一:vue项目首次安装依赖,报错信息如下:
yarn install v1.22.21
[1/5] Validating package.json...
[2/5] Resolving packages...
warning webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
[3/5] Fetching packages...
error https://registry.nlark.com/@babel/runtime/download/@babel/runtime-7.14.0.tgz?cache=0&sync_timestamp=1619727414495&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.14.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "Unexpected end of data"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
解决办法如下:
删除 node_modules, package-lock.json, yarn.lock,文件后,重新下载依赖
二:node版本错误
error nanoid@5.0.7: The engine "node" is incompatible with this module. Expected version "^18 || >=20". Got "19.9.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
此时说明了版本要求 version "^18 || >=20"。想要得到18 或者20(包含)以上的版本,但是得到一个19的版本。更换一下node的版本就可以解决这个问题。