create-react-appができなかった話
2794 ワード
はじめに
Reactでもやってみようかと試したところエラーが出ました。
その内容と解決法についてです。
どこでエラーが発生したのか
npm install -g create-react-app
npm install -g create-react-app
は成功
create-react-app my-app
でエラー
エラー内容は
error A:\work\my-app\node_modules\ejs: Command failed.
Exit code: 1
Command: node ./postinstall.js
Arguments:
Directory: A:\work\my-app\node_modules\ejs
Aborting installation.
yarnpkg add --exact react react-dom react-scripts cra-template --cwd A:\work\practice\react-practice\my-app has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting generated file... node_modules
Deleting my-app/ from A:\work\
Done.
だそう
解決策
nodejs, npmのアップデートしてもエラー
そして、create-react-appはyarnでreactなどをインストールしてるらしいです。
ふと「そういえば前からyarnでインストールできないものあったな」と思い出しました。
そこで
create-react-app my-app --use-npm
としてみると
Success! Created my-app at A:\work\my-app
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run 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 my-app
npm start
Happy hacking!
Author And Source
この問題について(create-react-appができなかった話), 我々は、より多くの情報をここで見つけました https://qiita.com/risuney/items/2dcaed14396253967225著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .