Liao Pei
Liao Pei

Reputation: 31

why react-script build fails in cmd but succuss in npm scripts(npm run build)?

enter image description here

command react-scripts build always fails even though react-scripts.cmd exists under folder node_modules/.bin/ strangely: npm run build(build: react-scripts build) will run successfully

Upvotes: 0

Views: 124

Answers (2)

Liao Pei
Liao Pei

Reputation: 31

  1. Installing globally has solved my problem.

  2. npx is also useful.

  3. The third solution might be:

npm bin 
react-scripts build.

it will run locally

Upvotes: 0

felixmosh
felixmosh

Reputation: 35553

You probably not installed react-script globally, therefore it is located in the local node_module.

You can run it with npx

npx react-script build

or provide a path to it...

Upvotes: 2

Related Questions