Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React-scripts build error? #2

Closed
omidahourai opened this issue Apr 5, 2019 · 2 comments
Closed

React-scripts build error? #2

omidahourai opened this issue Apr 5, 2019 · 2 comments

Comments

@omidahourai
Copy link

I'm not really sure what this repo is, but I can't figure out why I'm getting an Invariant error when I'm trying to build my create-react-app project with Apollo dependencies. Any ideas?

From package.json

  "dependencies": {
    "apollo-cache-inmemory": "^1.5.1",
    "apollo-cache-redux": "^0.1.2",
    "apollo-client": "^2.5.1",
    "apollo-link": "^1.2.11",
    "apollo-link-error": "^1.1.10",
    "apollo-link-http": "^1.5.14",
    "connected-react-router": "^6.3.2",
    "cors": "^2.8.4",
    "dotenv": "^4.0.0",
    "express": "^4.16.4",
    "graphql": "^14.2.1",
    "graphql-tag": "^2.10.1",
    "history": "^4.9.0",
    "path": "^0.12.7",
    "prop-types": "^15.7.2",
    "react": "^16.8.5",
    "react-apollo": "^2.5.3",
    "react-dom": "^16.8.5",
    "react-helmet": "^5.2.0",
    "react-redux": "^6.0.1",
    "react-responsive": "^4.0.3",
    "react-router": "^5.0.0",
    "react-router-dom": "^5.0.0",
    "react-scripts": "^2.1.8",
    "react-snapshot": "^1.3.0",
    "recompose": "^0.30.0",
    "redux": "^4.0.1",
    "redux-actions": "^2.6.5",
    "redux-form": "^8.1.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "styled-components": "^4.2.0"
  },

Error:

$ react-scripts build && react-snapshot
Creating an optimized production build...

File sizes after gzip:

  183.35 KB (+696 B)  build/static/js/2.fec2c2d6.chunk.js
  10.53 KB (+133 B)   build/static/js/main.129c5f3b.chunk.js
  762 B               build/static/js/runtime~main.a8a9905a.js
  373 B               build/static/css/main.b2c2abb0.chunk.css

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  yarn global add serve
  serve -s build

Find out more about deployment here:

  https://bit.ly/CRA-deploy

🕷   Starting crawling http://localhost:61033/
client running env production
iconbtn function(e){return o.a.createElement(be,Object(de.pick)(e,["style","onClick","title"]),e.content?e.content:o.a.createElement(ge,{icon:e.icon}),e.text)}
Error: Uncaught [Invariant Violation: Invariant Violation: 1 (see https://github.com/apollographql/invariant-packages)]
    at reportException (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:58:24)
    at processJavaScript (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:130:7)
    at HTMLScriptElementImpl._eval (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:65:7)
    at /Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:31:22
    at Object.check (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:89:11)
    at Object.check (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:92:23)
    at /Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:108:12
    at wrappedEnqueued (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:255:16)
    at Request.request [as _callback] (/Users/oahourai/Development/storyfork/web/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:203:9)
    at Request.self.callback (/Users/oahourai/Development/storyfork/web/node_modules/request/request.js:185:22) { Invariant Violation: Invariant Violation: 1 (see https://github.com/apollographql/invariant-packages)
    at new t (http://localhost:61033/static/js/2.fec2c2d6.chunk.js:1:355286)
    at http://localhost:61033/static/js/2.fec2c2d6.chunk.js:1:356406
    at v (http://localhost:61033/static/js/2.fec2c2d6.chunk.js:1:356415)
    at new t (http://localhost:61033/static/js/2.fec2c2d6.chunk.js:1:359389)
    at Module.312 (http://localhost:61033/static/js/main.129c5f3b.chunk.js:1:31774)
    at f (http://localhost:61033/:1:518)
    at Object.184 (http://localhost:61033/static/js/main.129c5f3b.chunk.js:1:3999)
    at f (http://localhost:61033/:1:518)
    at a (http://localhost:61033/:1:387)
    at Array.e [as push] (http://localhost:61033/:1:250) framesToPop: 1, name: 'Invariant Violation' }
🔥 'render' from react-snapshot was never called. Did you replace the call to ReactDOM.render()?
🕸   Finished crawling.
✨  Done in 28.70s.
@benjamn
Copy link
Member

benjamn commented Apr 23, 2019

Can you reproduce the error in development?

The error strings are sanitized in production to save (a lot of) bundle size, though it's possible track the error code (1 in this case) back to the corresponding invariant call in the source code (see the Error codes section of the README).

However, if the problem is reproducible in development, then the original error message will be preserved, so you don't have to do any digging.

@omidahourai
Copy link
Author

Ah, I forget how I resolved it (should have posted back, sorry!). But most likely it was something around updating my dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants