LoginSignup
0
0

More than 1 year has passed since last update.

Windowsでcreate-react-appでテンプレートが作成されないとき

Last updated at Posted at 2021-06-08

 create-react-appで作成されない

create-react-appで二度目以降、
固まって

...
yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd myapp
  yarn start

Happy hacking!

のところまでいかず

...
Done in ~s

と出て何も変わらない人向けの記事です。
ちなみに一度固まったらいくら待っても

installing

とはなりません。ご注意を。

 上のメッセージに関わらず、きちんと実行できないときの対策

1.後述
2.グローバルにcreate-react-appを過去installした場合
https://qiita.com/dhythm/items/92b3188d32ab5a5fd0e2
理由は知りませんがcreate-react-appはグローバルにインストールしない方がよさそうです。
3. package.jsonがどこかしら残ってる場合。
消しましょう。アプリは専用のホームディレクトリでなく専用フォルダを作って実装した方が良いらしいです。

4.npmのキャッシュが多すぎる場合
下のコマンドを実行
npm cache clean --force

5.エラーメッセージ:npm, yarnでインストールに時間がかかります!と出た場合。

into There appears to be trouble with your network connection . Retrying...

yarn installを行うディレクトリで
.yarnrcというファイルを作り中に
network-timeout 600000
と記述する。もしくは下記のコマンドを実行。
yarn add YourPackageHere --network-timeout 100000

6.1~5まででは解決できなかった場合
npx の後に--ignore-existing を挟むと上手くいくことがある
例:npx --ignore-existing create-react-app my-app --template typescript

7.nodeのヴァージョンが古すぎたり、新しすぎると上手くいかない。こともあるらしい

8.最後の手段
フォルダ内のデータをすべて削除、create-react-appグローバルもローカルもアンインストール、npm, yarnアンインストール、nodeアンインストールしてもう一度色々とインストール。(でもウィンドウズだと結構メンドクサイ。。。)

1

参照先→https://stackoverflow.com/questions/58738299/cannot-create-react-app-template-npm-hangs/64535070#64535070?newreg=5c66d561771e4371ba76a29623b107bb

デスクトップ左下の検索欄から「リソースモニター」を実行。
そのCPUタグを押したうえで
create-react-appコマンドを実行。
それで中断したcmd.exeを右クリックして「プロセスの再開」をクリック。

原因

多分ずぼらな性格のせいで、勝手に作動するセキュリティソフト?ByteFenceを放置していたから。

最後

役に立ったらグッド反応ください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0