npm ERR! code ENOLOCAL npm ERR! Could not install from “” as it does not contain a package.json file. npm ERR! A complete log of this run can be found in: npm ERR!

yarn安装

执行操作
npm i -g -yarn
报错信息
npm ERR! code ENOLOCAL
npm ERR! Could not install from "" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-03-09T01_57_51_835Z-debug.log
报错原因
npm i -g -yarn 下载命令有错
正确命令为 npm install -g yarn 
若还是报错,请执行
npm install -g install 
# 执行结束后,在新的cmd窗口重新输入 
npm install -g yarn 
验证安装是否成功
yarn -v
欢迎大家交流学习,任何问题都可以留言
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐