yarn install 安装报错问题
前言:今天使用 wb 新建 react 项目时,出现如下问题:
提示说明:与 yarn 有关。且与淘宝镜像有关,具体问题报告(log)如下:
:~/Code/larabbs$ yarn config set registry https://registry.npm. taobao.org yarn config v0.27.5 success Set "registry" to "https://registry.npm.taobao.org". Done in 1.55s. :~/Code/larabbs$ yarn install yarn install v0.27.5 info No lockfile found. [1/4] Resolving packages... warning laravel-mix > img-loader > imagemin-mozjpeg > mozjpeg > bin-wrapper > do wnload > gulp-decompress > 3.0.8: gulp-util is deprecated - replace it , following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 [2/4] Fetching packages... warning 1.1.3: The platform "linux" is incompatible with this module. info "" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... error An unexpected error occurred: "EPROTO: protocol error, symlink ‘../acorn/b in/acorn‘ -> ‘/home/vagrant/Code/larabbs/nodemodules/acorn-dynamic-import/node modules/.bin/acorn‘". info If you think this is a bug, please open a bug report with the information provided in "/home/vagrant/Code/larabbs/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
原因:主要是 yarn 的淘宝镜像问题。
解决:
网上查找解决方法如下:
执行以下命令: 1. yarn config set registry https://registry.npm.taobao.org/ 2. rm -rf /node_modules 3. yarn install --no-bin-links 确认没有错误再往下执行,不然就还得排查错误。 另外,有时候 rm -rf node_modules,重新 yarn install 就可以解决问题,祝好运。
由于博主使用的是 windows 系统,只执行命令1,如下:
yarn config set registry https://registry.npm.taobao.org/
只执行了这句命令,再次创建就成功了。
相关推荐
yegen00 2020-10-21
Notzuonotdied 2020-09-17
hline 2020-07-29
tomli 2020-07-26
xieting 2020-07-04
YarnSup 2020-06-28
flyingbird 2020-06-14
Notzuonotdied 2020-06-13
xieting 2020-05-29
tomli 2020-05-27
xieting 2020-05-26
tomli 2020-05-25
tomli 2020-05-11