使用npx創(chuàng)建react腳手架應(yīng)用,使用命令
npx create-react-app 項(xiàng)目名

image.png
從圖片看是驗(yàn)證失敗了,可以看出是從淘寶鏡像源獲取的,可是我不禁想起我npm并沒(méi)有使用淘寶源啊,仔細(xì)看發(fā)現(xiàn)報(bào)錯(cuò)的內(nèi)容是yarn命令。
所以npx create-react-app 實(shí)際使用了yarn!!!
參見(jiàn)https://stackoverflow.com/questions/63266392/does-npx-uses-yarn
所以解決方案很簡(jiǎn)單
yarn config set registry https://registry.npmjs.org/
yarn改回默認(rèn)源