简体   繁体   English

npm 开始不起作用 | 未加载 React 应用程序

[英]npm start not working | Not Loading React Application

npm start command not progressing after below point - npm start命令在以下点之后没有进展 -

在此处输入图片说明

Application is not getting loaded due to this.由于这个原因,应用程序没有被加载。

Below is package.json -下面是 package.json -

{
  "name": "reacttest",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.12.1",
    "@material-ui/data-grid": "^4.0.0-alpha.33",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-facebook-login": "^4.1.1",
    "react-google-login": "^5.2.2",
    "react-redux": "^7.2.4",
    "react-scripts": "4.0.3",
    "redux": "^4.1.0",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "set HTTPS=true&&react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Windows (cmd.exe) Windows (cmd.exe)

set HTTPS=true&&npm start

Windows (Powershell) Windows (Powershell)

($env:HTTPS = "true") -and (npm start)

Linux, macOS (Bash) Linux、macOS (Bash)

HTTPS=true npm start

add variable in .env在 .env 中添加变量

 REACT_APP_HTTPS = true

and in script并在脚本中

"scripts": {
    "start": "react-scripts start",
    ....
}

then run npm start and see.然后运行 ​​npm start 看看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM