{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/react-starter/issues/55","labels_url":"https://api.github.com/repos/webpack/react-starter/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/webpack/react-starter/issues/55/comments","events_url":"https://api.github.com/repos/webpack/react-starter/issues/55/events","html_url":"https://github.com/webpack/react-starter/issues/55","id":62289173,"number":55,"title":"ReferenceError: document is not defined when running a production server.","user":{"login":"ShuoShen","id":435537,"avatar_url":"https://avatars.githubusercontent.com/u/435537?v=3","gravatar_id":"","url":"https://api.github.com/users/ShuoShen","html_url":"https://github.com/ShuoShen","followers_url":"https://api.github.com/users/ShuoShen/followers","following_url":"https://api.github.com/users/ShuoShen/following{/other_user}","gists_url":"https://api.github.com/users/ShuoShen/gists{/gist_id}","starred_url":"https://api.github.com/users/ShuoShen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShuoShen/subscriptions","organizations_url":"https://api.github.com/users/ShuoShen/orgs","repos_url":"https://api.github.com/users/ShuoShen/repos","events_url":"https://api.github.com/users/ShuoShen/events{/privacy}","received_events_url":"https://api.github.com/users/ShuoShen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-17T05:16:19Z","updated_at":"2015-03-19T12:49:44Z","closed_at":null,"body":"This happens when I'm using the domquery module. The issue can be reproduced in the following four steps: \r\n\r\n# 1. install the components\r\n$ npm install domquery; npm install matches-selector; npm install closest; npm install event;\r\n\r\n# 2. change the following file: \r\n--- a/app/Home/index.jsx\r\n+++ b/app/Home/index.jsx\r\n@@ -1,5 +1,6 @@\r\n var React = require(\"react\");\r\n var Link = require(\"react-router\").Link;\r\n+var dom = require('domquery')\r\n\r\n# 3. run build \r\n$ npm run build; \r\n\r\n# 4. run start, which gives the error: \r\n$ npm run start\r\n\r\nerror message below\r\n==================================================================\r\n> react-starter@0.0.0 start /Users/shen/Documents/workspace/react-starter\r\n> node lib/server-production\r\n\r\n/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:5860\r\n\t  var doc = document\r\n\t            ^\r\nReferenceError: document is not defined\r\n    at /Users/shen/Documents/workspace/react-starter/build/prerender/main.js:5860:14\r\n    at doc (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:5856:73)\r\n    at Object.<anonymous> (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:5859:4)\r\n    at __webpack_require__ (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:21:30)\r\n    at Object.module.exports.module.exports (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:5029:14)\r\n    at __webpack_require__ (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:21:30)\r\n    at Object.<anonymous> (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:4760:17)\r\n    at __webpack_require__ (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:21:30)\r\n    at Object.<anonymous> (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:4987:15)\r\n    at __webpack_require__ (/Users/shen/Documents/workspace/react-starter/build/prerender/main.js:21:30)\r\n\r\nnpm ERR! react-starter@0.0.0 start: `node lib/server-production`\r\nnpm ERR! Exit status 8\r\nnpm ERR! \r\nnpm ERR! Failed at the react-starter@0.0.0 start script.\r\nnpm ERR! This is most likely a problem with the react-starter package,\r\nnpm ERR! not with npm itself.\r\nnpm ERR! Tell the author that this fails on your system:\r\nnpm ERR!     node lib/server-production\r\nnpm ERR! You can get their info via:\r\nnpm ERR!     npm owner ls react-starter\r\nnpm ERR! There is likely additional logging output above.\r\nnpm ERR! System Darwin 13.4.0\r\nnpm ERR! command \"/usr/local/Cellar/node/0.10.24/bin/node\" \"/usr/local/bin/npm\" \"run\" \"start\"\r\nnpm ERR! cwd /Users/shen/Documents/workspace/react-starter\r\nnpm ERR! node -v v0.10.24\r\nnpm ERR! npm -v 1.3.21\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! \r\nnpm ERR! Additional logging details can be found in:\r\nnpm ERR!     /Users/shen/Documents/workspace/react-starter/npm-debug.log\r\nnpm ERR! not ok code 0\r\n\r\n\r\nWhat is the cause of this error? Please help! Thanks. "},"comment":{"url":"https://api.github.com/repos/webpack/react-starter/issues/comments/83543077","html_url":"https://github.com/webpack/react-starter/issues/55#issuecomment-83543077","issue_url":"https://api.github.com/repos/webpack/react-starter/issues/55","id":83543077,"user":{"login":"sokra","id":1365881,"avatar_url":"https://avatars.githubusercontent.com/u/1365881?v=3","gravatar_id":"","url":"https://api.github.com/users/sokra","html_url":"https://github.com/sokra","followers_url":"https://api.github.com/users/sokra/followers","following_url":"https://api.github.com/users/sokra/following{/other_user}","gists_url":"https://api.github.com/users/sokra/gists{/gist_id}","starred_url":"https://api.github.com/users/sokra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sokra/subscriptions","organizations_url":"https://api.github.com/users/sokra/orgs","repos_url":"https://api.github.com/users/sokra/repos","events_url":"https://api.github.com/users/sokra/events{/privacy}","received_events_url":"https://api.github.com/users/sokra/received_events","type":"User","site_admin":false},"created_at":"2015-03-19T12:49:44Z","updated_at":"2015-03-19T12:49:44Z","body":"There is no DOM while prerendering.\r\nWrite your components without using the DOM, or\r\nrequire DOM specific stuff in `componentDidMount`."}}