質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

Q&A

解決済

2回答

322閲覧

react 開発環境作成時のエラーについて

hiro5757

総合スコア10

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

0グッド

0クリップ

投稿2019/03/04 15:13

前提・実現したいこと

ここに質問の内容を詳しく書いてください。

reactの開発環境をつくっているときに$npm startを入力すると下のコードのようにエラーをはきます。

これの解決方法をどうか教えていただきたいのです

発生している問題・エラーメッセージ

エラーメッセージ

該当のソースコード

javaScript (react) ソースコード > project@0.1.0 start /Users/hiro57/Documents/git/reactTodoList/project > react-scripts start There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create React App requires a dependency: "webpack": "4.28.3" Don't try to install it manually: your package manager does it automatically. However, a different version of webpack was detected higher up in the tree: /Users/hiro57/node_modules/webpack (version: 4.29.5) Manually installing incompatible versions is known to cause hard-to-debug issues. If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will permanently disable this message but you might encounter other issues. To fix the dependency tree, try following the steps below in the exact order: 1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder. 2. Delete node_modules in your project folder. 3. Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder. 4. Run npm install or yarn, depending on the package manager you use. In most cases, this should be enough to fix the problem. If this has not helped, there are a few other things you can try: 5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead. This may help because npm has known issues with package hoisting which may get resolved in future versions. 6. Check if /Users/hiro57/node_modules/webpack is outside your project directory. For example, you might have accidentally installed something in your home folder. 7. Try running npm ls webpack in your project folder. This will tell you which other package (apart from the expected react-scripts) installed webpack. If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That would permanently disable this preflight check in case you want to proceed anyway. P.S. We know this message is long but please read the steps above :-) We hope you find them helpful! npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! project@0.1.0 start: `react-scripts start` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the project@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/hiro57/.npm/_logs/2019-03-04T14_58_48_256Z-debug.log satouhiroshitonoMacBook-ea:project hiro57$ satouhiroshitonoMacBook-ea:project hiro57$ satouhiroshitonoMacBook-ea:project hiro57$ satouhiroshitonoMacBook-ea:project hiro57$ npm -v 6.7.0

試したこと

言われたとおり、ファイルを消してみたり、バージョンを変更したりなどいろいろしてみたのですがエラーをはきつづけてくれているわけです

ここに問題に対して試したことを記載してください。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2019/03/04 15:20

/Users/hiro57/.npm/_logs/2019-03-04T14_58_48_256Z-debug.logの内容はどうなってますか?
hiro5757

2019/03/04 15:30

このような内容になっています 0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] 2 info using npm@6.7.0 3 info using node@v11.10.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle project@0.1.0~prestart: project@0.1.0 6 info lifecycle project@0.1.0~start: project@0.1.0 7 verbose lifecycle project@0.1.0~start: unsafe-perm in lifecycle true 8 verbose lifecycle project@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/hiro57/Documents/git/reactTodoList/project/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 9 verbose lifecycle project@0.1.0~start: CWD: /Users/hiro57/Documents/git/reactTodoList/project 10 silly lifecycle project@0.1.0~start: Args: [ '-c', 'react-scripts start' ] 11 silly lifecycle project@0.1.0~start: Returned: code: 1 signal: null 12 info lifecycle project@0.1.0~start: Failed to exec start script 13 verbose stack Error: project@0.1.0 start: `react-scripts start` 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16) 13 verbose stack at EventEmitter.emit (events.js:197:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:197:13) 13 verbose stack at maybeClose (internal/child_process.js:984:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5) 14 verbose pkgid project@0.1.0 15 verbose cwd /Users/hiro57/Documents/git/reactTodoList/project 16 verbose Darwin 17.7.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 18 verbose node v11.10.0 19 verbose npm v6.7.0 20 error code ELIFECYCLE 21 error errno 1 22 error project@0.1.0 start: `react-scripts start` 22 error Exit status 1 23 error Failed at the project@0.1.0 start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]
noka_blank

2019/03/06 00:29

npmのキャッシュをクリアしてから再実行してみてはどうでしょうか? # インストールされたjsモジュールを全部消す rm -rf node_modules # インストールされたjsモジュールのバージョン情報を消す rm package-lock.json yarn.lock # npmのキャッシュをクリアする npm cache clear --force # 再度jsモジュールを全部入れ直して、実行する npm install
hiro5757

2019/03/07 08:29

改善しませんでした
noka_blank

2019/03/07 16:03

エラーメッセージを読む限り、webpackのバージョンが合っていないようです。 エラーメッセージの手順にある通り、 1. package-lock.json or yarn.lockを削除 2. node_modulesディレクトリを丸ごと削除 3. package.jsonにwebpackがあれば削除 4. npm install or yarn install を試してみるのが良いと思います。 create-react-appを使った場合、webpackは自動的にインストールされますので、何らかのカスタマイズをされていると思うのですが、インストール手順をご教示いただけないでしょうか?
hiro5757

2019/03/08 02:34

npm をいちど消してもう一度バージョンを落としてから設定し直したらできました アドバイスありがとうございました
noka_blank

2019/03/08 04:15

解決できてよかったです^_^
guest

回答2

0

自己解決

npm のバージョンを変えたらできた

投稿2019/03/08 02:35

hiro5757

総合スコア10

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

create-react-app <プロジェクト名> で開発環境を作りましたか?

投稿2019/03/04 16:58

編集2019/03/04 16:59
SAMSONSAN

総合スコア12

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hiro5757

2019/03/04 17:48

つくりましたがおなじようなエラーがでました
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問