首页 > 解决方案 > 如何解决 install -g yarn 上的 npm 错误?

问题描述

我想运行这个命令并安装纱线

npm install -g yarn

但我得到这个错误

npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\DigiMax\AppData\Roaming\npm\node_modules\yarn
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DigiMax\AppData\Local\npm-cache\_logs\2021-07-03T15_03_24_683Z-debug.log

我怎么解决这个问题?

标签: npmyarnpkg

解决方案


最快的解决方案npm cache cleannpm cache verify大多数情况下都有效。

根据docs.npmjs,您应该检查您的 npm 版本并在需要时进行更新,或者在最坏的情况下重新安装它。

请让我们知道它是否有效


推荐阅读