coryhouse / react-slingshot

React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
MIT License
9.74k stars 2.94k forks source link

undefinedcreateProvider error when application starts #587

Closed rpk-red closed 6 years ago

rpk-red commented 6 years ago

When I run npm start -s sometimes I get the following error when application starts:

Uncaught ReferenceError: undefinedcreateProvider is not defined
    at eval (webpack-internal:///./node_modules/react-redux/es/components/Provider.js:80)
    at Module../node_modules/react-redux/es/components/Provider.js (bundle.js:12222)
    at __webpack_require__ (bundle.js:725)
    at fn (bundle.js:102)
    at eval (webpack-internal:///./node_modules/react-redux/es/index.js:2)
    at Module../node_modules/react-redux/es/index.js (bundle.js:12330)
    at __webpack_require__ (bundle.js:725)
    at fn (bundle.js:102)
    at Module.eval (webpack-internal:///./src/index.js:6)
    at eval (webpack-internal:///./src/index.js:188)

Strange part is that this does not happen every time. On avrg it happens ever 3th time when I run command.

nickytonline commented 6 years ago

Hi @rpkRED, is this with afresh clone of react-slingshot? Also, can you let us know which version of node you're running,operating system etc. Thanks!

rpk-red commented 6 years ago

From existing that I have react-slingshot I update files package.json, dev and prod config. Windows 10 x64 node v8.12.0 npm v6.4.1 my package.json:

{
  "name": "myApp",
  "version": "1.0.0",
  "description": "application",
  "engines": {
    "npm": ">=3"
  },
  "scripts": {
    "preinstall": "node tools/nodeVersionCheck.js",
    "start-message": "babel-node tools/startMessage.js",
    "prestart": "npm run start-message",
    "start": "concurrently -k -r -s first \"npm run test:watch\" \"npm run open:src\" \"npm run lint:watch\"",
    "open:src": "babel-node tools/srcServer.js",
    "open:dist": "babel-node tools/distServer.js",
    "lint": "esw webpack.config.* src tools --color",
    "lint:watch": "npm run lint -- --watch",
    "clean-dist": "npm run remove-dist && mkdir dist",
    "remove-dist": "rimraf ./dist",
    "prebuild": "npm run lint && npm run clean-dist",
    "build": "babel-node tools/build.js",
    "test": "jest -i --env=jsdom --json",
    "test:CI": "babel-node tools/testCi.js",
    "test:cover": "npm run test -- --coverage | jest-json-to-tap | tap-xunit > TEST-result.xml ",
    "test:cover:CI": "npm run test:CI -- --coverage && cat ./coverage/lcov.info | node_modules/coveralls/bin/coveralls.js",
    "test:watch": "npm run test -- --watch",
    "open:cover": "npm run test:cover && opn ./coverage/lcov-report/index.html",
    "analyze-bundle": "babel-node ./tools/analyzeBundle.js"
  },
  "author": "Me",
  "license": "MIT",
  "dependencies": {
    "@material-ui/core": "3.1.0",
    "@material-ui/icons": "3.0.1",
    "cuid": "2.1.4",
    "normalizr": "3.2.4",
    "react": "16.5.2",
    "react-autosuggest": "9.4.2",
    "react-dom": "16.5.2",
    "react-redux": "5.0.7",
    "react-router-dom": "4.2.2",
    "redux": "3.7.2",
    "redux-orm": "0.9.4",
    "redux-thunk": "2.3.0",
    "reselect": "3.0.1"
  },
  "devDependencies": {
    "@babel/cli": "7.0.0",
    "@babel/core": "7.0.0",
    "@babel/node": "7.0.0",
    "@babel/plugin-proposal-class-properties": "7.0.0",
    "@babel/plugin-transform-react-constant-elements": "7.0.0",
    "@babel/polyfill": "7.0.0",
    "@babel/preset-env": "7.0.0",
    "@babel/preset-react": "7.0.0",
    "@devexpress/dx-react-core": "1.7.2",
    "@devexpress/dx-react-grid": "1.7.2",
    "@devexpress/dx-react-grid-material-ui": "1.7.2",
    "adal-angular": "1.0.17",
    "autoprefixer": "9.1.5",
    "autosuggest-highlight": "3.1.1",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "9.0.0",
    "babel-jest": "23.6.0",
    "babel-loader": "8.0.2",
    "babel-plugin-transform-react-constant-elements": "6.23.0",
    "babel-plugin-transform-react-remove-prop-types": "0.4.18",
    "browser-sync": "2.24.7",
    "chalk": "2.4.1",
    "concurrently": "4.0.1",
    "connect-history-api-fallback": "1.5.0",
    "coveralls": "3.0.2",
    "css-loader": "1.0.0",
    "enzyme": "3.6.0",
    "enzyme-adapter-react-16": "1.5.0",
    "enzyme-to-json": "3.3.4",
    "eslint": "5.6.0",
    "eslint-plugin-import": "2.14.0",
    "eslint-plugin-react": "7.11.1",
    "eslint-watch": "4.0.2",
    "file-loader": "2.0.0",
    "hard-source-webpack-plugin": "0.11.1",
    "html-webpack-plugin": "3.2.0",
    "identity-obj-proxy": "3.0.0",
    "jest": "23.6.0",
    "jest-cli": "23.6.0",
    "jest-json-to-tap": "2.1.0",
    "json-loader": "0.5.7",
    "lodash": "4.17.11",
    "material-ui-pickers": "1.0.0-rc.14",
    "mini-css-extract-plugin": "0.4.2",
    "mockdate": "2.0.2",
    "moment": "2.22.2",
    "node-sass": "4.9.3",
    "numeral": "2.0.6",
    "object-hash": "1.3.0",
    "opn-cli": "3.1.0",
    "postcss-loader": "3.0.0",
    "prompt": "1.0.0",
    "prop-types": "15.6.2",
    "react-hot-loader": "4.3.11",
    "react-number-format": "3.6.0",
    "react-popper": "1.0.2",
    "react-select": "^2.0.0",
    "react-test-renderer": "16.5.2",
    "react-travel": "1.3.6",
    "react-validation": "3.0.7",
    "redux-immutable-state-invariant": "2.1.0",
    "replace": "1.0.0",
    "rimraf": "2.6.2",
    "sass-loader": "6.0.6",
    "style-loader": "0.23.0",
    "tap-xunit": "2.3.0",
    "typeface-roboto": "0.0.54",
    "url-loader": "1.1.1",
    "uuid": "3.3.2",
    "validator": "10.7.1",
    "webpack": "4.19.1",
    "webpack-bundle-analyzer": "3.0.2",
    "webpack-dev-middleware": "3.3.0",
    "webpack-hot-middleware": "2.24.2"
  },
  "keywords": [],
  "jest": {
    "setupFiles": [
      "./src/utilities/react16/shim",
      "./src/utilities/test/jestsetup"
    ],
    "coverageReporters": [
      "json",
      "lcov",
      "text",
      "cobertura"
    ],
    "snapshotSerializers": [
      "enzyme-to-json/serializer"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tools/assetsTransformer.js",
      "\\.(css|less)$": "<rootDir>/tools/assetsTransformer.js"
    }
  },
  "babel": {
    "env": {
      "development": {
        "presets": [
          "@babel/preset-env",
          "@babel/preset-react"
        ],
        "plugins": [
          "@babel/plugin-proposal-class-properties",
          "react-hot-loader/babel"
        ]
      },
      "production": {
        "presets": [
          [
            "@babel/preset-env",
            {
              "targets": {
                "ie": 9
              },
              "forceAllTransforms": true
            }
          ],
          "@babel/preset-react"
        ],
        "plugins": [
          "@babel/plugin-proposal-class-properties",
          "@babel/transform-react-constant-elements",
          "transform-react-remove-prop-types"
        ]
      },
      "test": {
        "presets": [
          "@babel/preset-env",
          "@babel/preset-react"
        ],
        "plugins": [
          "@babel/plugin-proposal-class-properties"
        ]
      }
    }
  },
  "eslintConfig": {
    "root": true,
    "extends": [
      "eslint:recommended",
      "plugin:import/errors",
      "plugin:import/warnings",
      "plugin:react/recommended"
    ],
    "plugins": [
      "react"
    ],
    "parser": "babel-eslint",
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
      }
    },
    "env": {
      "es6": true,
      "browser": true,
      "node": true,
      "jquery": true,
      "jest": true
    },
    "globals": {
      "shallow": true,
      "mount": true,
      "render": true
    }
  }
}
coryhouse commented 6 years ago

I suggest pasting your app's code into a fresh clone of slingshot to assure you have all the latest config.

rpk-red commented 6 years ago

It works now, problem was with some package version and i'm not sure witch one. But now I have new problem when i deploy application on azure I get the following error: Uncaught SyntaxError: Invalid regular expression: /^[Α-ω]+$/: Range out of order in character class at Object.<anonymous> (main.eb8e15138060192e8836.js:24) at n (main.eb8e15138060192e8836.js:1) at Object.<anonymous> (main.eb8e15138060192e8836.js:74) at n (main.eb8e15138060192e8836.js:1) at Object.<anonymous> (main.eb8e15138060192e8836.js:20) at n (main.eb8e15138060192e8836.js:1) at Module.<anonymous> (main.eb8e15138060192e8836.js:99) at n (main.eb8e15138060192e8836.js:1) at main.eb8e15138060192e8836.js:1 at main.eb8e15138060192e8836.js:1 Any idea what can be the problem?

nickytonline commented 6 years ago

@rpkRED, glad you got your initial error sorted out. If you build your prod build locally and run it via an package like http-server, does the app load? If so, I'd refer to Azure deployment documentation.

rpk-red commented 6 years ago

Problem was with validator.js it does not work after version 8.2.0 on azure for some reason. Downgrading it to 8.2.0 fixed the problem. Application worked with http-server, thank you for your help.

nickytonline commented 6 years ago

Great to here everything is sorted out.