我已經嘗試了這兩個命令,但遇到了同樣的錯誤。
npm clean cache --force
npx create-react-app client -timeout=120000
$ npx create-react-app client -timeout=120000
npm WARN exec The following package was not found and will be installed: create-react-app
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Creating a new React app in C:\web_dev\MERN\projects\booking-app\client.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network request to https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz failed, reason: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\web_dev\MERN\projects\booking-app\tmpnodejsnpm-cache\_logs\2021-12-29T13_37_03_989Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting client/ from C:\web_dev\MERN\projects\booking-app
Done.
uj5u.com熱心網友回復:
你有沒有試過錯誤所說的
a) 你在線嗎
b)你是代理還是VPN
c)您是否正確配置了日志
我喜歡更多的背景關系,比如你的作業系統和東西
uj5u.com熱心網友回復:
我遇到了同樣的問題,所以我全域卸載它然后重新安裝:-
- npm uninstall -g create-react-app
- npm 卸載 create-react-app
然后我使用了 npx:-
- npx create-react-app project-app
告訴我這是否適合你
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/396974.html
