使用几个npm软件包启动一个React应用程序

时间:2019-03-05 16:34:21

标签: reactjs redux material-ui package.json jss

  • 我正在尝试提出我的申请。
  • 我有两个package.json,一个用于服务器,另一个用于客户端。
  • 当我npm运行build时,客户端和根文件夹中的构建均成功
    • 当我执行npm run dev时,应用程序未运行。
  • 所以我调试并在控制台中找到错误 -及其指向此文件的响应-dom.production.min.js:198和CSS-vendor.esm.js:67
    • 我认为问题是由于此packages.jss-预设-default和react-jss
      • 您能告诉我如何解决此问题吗?请在下面提供我的package.json和错误

客户端package.json

{
  "name": "players",
    "version": "0.1.0",
      "private": true,
        "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.14",
      "@fortawesome/free-solid-svg-icons": "^5.7.1",
        "@fortawesome/react-fontawesome": "^0.1.4",
          "@material-ui/core": "^3.9.2",
            "autosuggest-highlight": "^3.1.1",
              "axios": "^0.18.0",
                "fa5-pro-light": "^5.6.1",
                  "fa5-pro-regular": "^5.6.1",
                    "fa5-pro-solids": "^5.6.1",
                      "gos-theme": "^3.1.0",
                        "jss-preset-default": "^10.0.0-alpha.7",
                          "leaflet": "^1.3.3",
                            "leaflet.markercluster": "^1.3.0",
                              "lodash": "^4.17.10",
                                "material-ui-chip-input": "^1.0.0-beta.7",
                                  "react": "^16.4.1",
                                    "react-autosuggest": "^9.3.4",
                                      "react-csv": "^1.0.14",
                                        "react-dom": "^16.4.1",
                                          "react-helmet": "^5.2.0",
                                            "react-icons-kit": "^1.1.5",
                                              "react-jss": "^8.6.1",
                                                "react-leaflet": "^2.0.1",
                                                  "react-leaflet-markercluster": "^2.0.0-rc3",
                                                    "react-redux": "^5.0.7",
                                                      "react-redux-loading-bar": "^4.2.0",
                                                        "react-router-dom": "^4.3.1",
                                                          "react-scripts": "1.1.4",
                                                            "react-select": "^2.0.0",
                                                              "react-to-print": "^2.0.0-alpha-6",
                                                                "redux": "^4.0.0",
                                                                  "redux-form": "^7.4.2",
                                                                    "redux-promise": "^0.6.0",
                                                                      "redux-thunk": "^2.3.0",
                                                                        "styled-components": "^3.4.9"
  },
  "scripts": 

    {
        "start": "react-scripts start",
          "build": "react-scripts build",
            "test": "react-scripts test --env=jsdom",
              "eject": "react-scripts eject",
                "setup": "npm install fa5-pro-light fa5-pro-solids fa5-pro-regular gos-theme --registry http://artifactory.bcbsfl.com/artifactory/api/npm/npm-libs-virtual"
      }

,


    "devDependencies": {
        "enzyme": "^3.3.0",
          "enzyme-adapter-react-16": "^1.1.1",
            "moxios": "^0.4.0"
      }

}

根文件夹package.json

{
  "name": "sports",
    "version": "1.0.0",
      "description": "",
        "main": "index.js",
          "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
      "start": "node index.js",
        "server": "nodemon index.js",
          "client": "cd .. && npm run start",
            "dev": "concurrently \"npm run server\" \"npm run client\"",
              "build": "cd client && npm install && npm run build && cd ..",
                "qb": "cd client && npm run build && cd .."
  },
  "keywords": [],
    "author": "",
      "license": "ISC",
        "dependencies": {
    "axios": "^0.18.0",
      "body-parser": "^1.18.3",
      "compression": "^1.7.3",
       "config": "^2.0.1",
        "cors": "^2.8.4",
        "dotenv": "^6.2.0",
         "exceljs": "^1.6.2",
          "express": "^4.16.4",
           "joi": "^14.0.3",
            "jsonwebtoken": "^8.3.0"
  },
  "devDependencies": {
    "concurrently": "^4.0.1",
      "nodemon": "^1.18.5"
  },
  "jest": {
    "roots": [
      "server"
    ]
  },
  "standard": {
    "ignore": [
      "**/node_modules/",
      "**/coverage/"
    ]
  }
}

错误

react - dom.production.min.js: 198 TypeError: Cannot read property '1' of undefined
at r(css - vendor.esm.js: 67)
at Array.e(jss - plugin - vendor - prefixer.esm.js: 14)
at e.value(PluginsRegistry.js: 56)
at Array.forEach(<anonymous>)
at e.value (RuleList.js:163)
at new e (StyleSheet.js:55)
at e.value (Jss.js:123)
at t.value (withStyles.js:286)
at t.value (withStyles.js:256)
at new t (withStyles.js:138)

react-dom.production.min.js:198
var ph = "function" === typeof WeakSet ? WeakSet : Set;
function qh(a, b) {
        var c = b.source
        , d = b.stack;
      null === d && null !== c && (d = jc(c));
      null !== c && ic(c.type);
      b = b.value;
      null !== a && 1 === a.tag && ic(a.type);
        try {
        // pointing here       console.error(b) // pointing here
      } catch (e) {
        setTimeout(function () {
          throw e;
        })
      }
      }



      Uncaught TypeError: Cannot read property '1' of undefined
      at r (css-vendor.esm.js:67)
      at Array.e (jss-plugin-vendor-prefixer.esm.js:14)
      at e.value (PluginsRegistry.js:56)
    at Array.forEach (<anonymous>)
  at e.value (RuleList.js:163)
  at new e (StyleSheet.js:55)
  at e.value (Jss.js:123)
  at t.value (withStyles.js:286)
  at t.value (withStyles.js:256)
  at new t (withStyles.js:138)


    function supportedKeyframes(key) {
  // Keyframes is already prefixed. e.g. key = '@-webkit-keyframes a'
// pointing here  if (key[1] === '-') return key; // No need to prefix IE/Edge. Older browsers will ignore unsupported rules.
  // https://caniuse.com/#search=keyframes

  if (prefix.js === 'ms') return key;
    return "@" + prefix.css + "keyframes" + key.substr(10);
  }

0 个答案:

没有答案