Search code examples
javascriptreactjsmacoscreate-react-app

Why does npm start of react say it cannot find


Want to open the localhost of react, but after entering npm start, the terminal says that it cannot find sh: env-cmd: command not found, but I can see it in JSON, everything is normal, and it has not been deleted. I can't find the problem. , so post this question and ask for help, thank you guys enter image description here enter image description here These two photos are screenshots of terminal and JSON thank you guys!(I use create react app to make this project,my operating system is Mac os,my editor is VScode)

I hope npm start can work smoothly, and open localhost


Solution

  • make sure env-cmd is installed in your machine :

    npm install -g env-cmd
    

    or at least in your project:

    npm install env-cmd
    

    Then close your terminal and restart it, if the issue still occurs try to update your node version