エラー発生:npm ERR! cb.apply is not a function
Reactの初期設定コマンドnpx create-react-app . --use-npm
を実行したところ、npm ERR! cb.apply is not a function
というエラーが発生しました。
twitter_react_frontend % npx create-react-app . --use-npm
(node:67518) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/toto/.npm/_logs/2024-01-28T02_58_52_906Z-debug.log
コード[ 'create-react-app@latest' ]で1のインストールに失敗しました
対応方法
アップデートとキャッシュのクリアにより、無事成功しました。
同じエラーが発生したときに、試してみてください。
- アップデート
twitter_react_frontend % npm install -g npm@latest
removed 25 packages, and changed 45 packages in 3s
24 packages are looking for funding
run `npm fund` for details
- キャッシュクリア
twitter_react_frontend % npm cache clean --force
- 成功
twitter_react_frontend % npx create-react-app . --use-npm
Creating a new React app in /Users/toto/Desktop/twitter_react_frontend.
〜〜
We suggest that you begin by typing:
cd /Users/toto/Desktop/twitter_react_frontend.
npm start
You had a `README.md` file, we renamed it to `README.old.md`
Happy hacking!