'react-scripts' is not recognized as an internal or external command

前端 未结 18 2263
清歌不尽
清歌不尽 2020-11-30 00:21

I\'ve got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks something like

mavenapp/src/main/jav

相关标签:
18条回答
  • 2020-11-30 00:40

    For Portable apps change

    package.json

    as follows

    "scripts": {
        "start": "node node_modules/.bin/react-scripts start",
        "build": "node node_modules/.bin/react-scripts build",
        "test": "node node_modules/.bin/react-scripts test",
        "eject": "node node_modules/.bin/react-scripts eject"
      }
    
    0 讨论(0)
  • 2020-11-30 00:41

    I have tried many of the solutions to this problem found on line, but in my case nothing worked except for reinstalling NVM for Windows (which I am using to manage multiple Node versions). In the installer, it detects installed Node versions and asks the user if they wish for NVM to control them. I said yes and NVM fixed all PATH issues. As a result, things worked as before. This issue may have multiple causes, but corrupted PATH is definitely one of them and (re)installing NVM fixes PATH.

    0 讨论(0)
  • 2020-11-30 00:46

    Faced the same problem, although I am using yarn.

    The following worked for me:

    yarn install 
    yarn start
    
    0 讨论(0)
  • 2020-11-30 00:47

    In my situation, some problems happened with my node package. So I run npm audit fix and it fixed all problems

    0 讨论(0)
  • 2020-11-30 00:48

    This is how I fix it

    1. Check and Update the path variable (See below on how to update the path variable)
    2. Delete node_modules and package-lock.json
    3. run npm install
    4. run npm run start

    if this didn't work, try to install the nodejs and run repair

    or clean npm cache npm cache clean --force

    To update the path variable

    1. press windows key
    2. Search for Edit the system environmental variable
    3. Click on Environment Variables...
    4. on System variable bottom section ( there will be two section )
    5. Select Path variable name
    6. Click Edit..
    7. Check if there is C:\Program Files\nodejs on the list, if not add this
    0 讨论(0)
  • 2020-11-30 00:48

    When I make a new project using React, to install the React modules I have to run "npm install" (PowerShell) from within the new projects ClientApp folder (e.g. "C:\Users\Chris\source\repos\HelloWorld2\HelloWorld2\ClientApp"). The .NET core WebApp with React needs to have the React files installed in the correct location for React commands to work properly.

    0 讨论(0)
提交回复
热议问题