yarn install 安裝報錯問題


   前言:今天使用 wb 新建 react 項目時,出現如下問題:

   

   提示說明:與 yarn 有關。且與淘寶鏡像有關,具體問題報告(log)如下:

vagrant@homestead:~/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.
vagrant@homestead:~/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 > gulp-util@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 fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" 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/

只執行了這句命令,再次創建就成功了。

 

  參考:https://laravel-china.org/index.php/topics/8670/yarn-install-installation-error-try-the-reply-of-the-former-students-or-not-the-big-gods-help-to-see-thank-you

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM