0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sh: react-scripts: command not foundの解決方法

Posted at

reactのプロジェクト始めようとしたら早速エラーで詰まったので備忘。

今回の構築環境

node -v
v20.14.0

npm --version
10.7.0

react": "^18.3.1",
"react-dom": "^18.3.1",

エラーの経緯

reactプロジェクトを始める

npx create-react-app project-name
cd project-name
npm start

npm startしたら以下のエラー出る。

npm start

> react-app@0.1.0 start
> react-scripts start

sh: react-scripts: command not found

解決した方法

package.jsonのコマンド部分を書き換える。

package.json 変更前
"scripts": {
    "start": "react-scripts start",
}
package.json 変更後
"scripts": {
    "start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start",
}

参考サイト

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?