Create React App not working

前端 未结 15 1337
清歌不尽
清歌不尽 2020-12-29 06:30

Help! I have no idea what is going on here, create react app is not working I have also tried reinstalling and yet to no avail, please help!

Npm version: 5

相关标签:
15条回答
  • 2020-12-29 06:44

    Tried all the above methods but no luck:(

    Step1 : Reinstalled Node js

    Step2 : Check whether environment variables has been created. if not create one for nodejs,npm and composer

    Step3: Also add "C:\Windows\System32" to the global PATH environment variable.

    Step4: Then use "npx create-react-app my-app" to create react project

    Step5: Run the commmand : cd my-app and npm start

    Step6: It will work

    0 讨论(0)
  • 2020-12-29 06:45

    I had similar issue while tried creating new react app with create-react-app, but related to some random JSON reading issues while installations like.. >= 5.0 || 4.0 ..

    But the fix below solves multiple and similar issues.

    First of all, make sure you have required or latest version of node installed.

    npm install npm@latest -g
    

    Before using create-react-app make sure you clean npm cache using npm cache clean --force

    Now, is should be fine to create new react app with npx create-react-app tl-app or npx create-react-app . if you want to create current directory as project root.

    0 讨论(0)
  • 2020-12-29 06:52

    What I did, is going to

    C:\Users\mycomputerName\AppData\Roaming\npm\

    I changed the name of this file

    create-react-app.ps1

    to

    create-react-appOld.ps1

    or you can delete it, then it worked fine

    0 讨论(0)
  • 2020-12-29 06:53

    If npm cache clean --force doesnt work please run the following

    npm init react-app project-name
    

    Replace 'project-name' with the name of the folder you'd want. Goodluck

    0 讨论(0)
  • 2020-12-29 06:55

    After no luck with updating my npm version and doing npm cache clean --force I ended up just doing a fresh install of node which fixed the issue for me.

    0 讨论(0)
  • 2020-12-29 06:56

    HAD the same problem. Running Node with cra. installed cra -g for starters.

    npm install -g create-react-app
    

    then downgraded react-scripts to version 2.1.8

    npm install react-scripts@2.1.8
    

    created a .env file in root directory and added this to it.

    DB_HOST=localhost
    DB_USER=root
    DB_PASS=s1mpl3
    
    SKIP_PREFLIGHT_CHECK=true
    

    Then you do the typical delete node_modules folder and the package-lock.json file.(NOT PACKAGE.JSON!!!)

    then:

    npm install
    npm start
    

    This worked for me. Sorry I'm not more informative on why this worked for me. I'm still trying to understand why it didn't work in the first place.

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