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

after upgrade to 1.0.0-alpha.45, vuepress build fails with ReferenceError: window is not defined #1498

Closed
1 task done
butameron opened this issue Mar 31, 2019 · 3 comments
Labels
priority: high High priority issue type: bug Something isn't working

Comments

@butameron
Copy link

  • I confirm that this is an issue rather than a question.

Bug report

Version

vuepress/1.0.0-alpha.45 linux-x64 node-v11.6.0

Steps to reproduce

at empty dir

$  yarn add -D vuepress@next
$ echo '# Hello VuePress' > README.md
$ npx vuepress build

What is expected?

npx vuepress build complete successfully.

What is actually happening?

npx vuepress build fails.

$  yarn add -D vuepress@next
$ echo '# Hello VuePress' > README.md
$ npx vuepress build
wait Extracting site metadata...
tip Apply theme @vuepress/theme-default ...
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...
[1:24:57 AM] Compiling Client
[1:24:58 AM] Compiling Server
[1:25:09 AM] Compiled Server in 11s
[1:25:12 AM] Compiled Client in 15s
wait Rendering static HTML...
Rendering page: /error Error rendering /: false
undefined
ReferenceError: window is not defined
    at createApp (node_modules/@vuepress/core/lib/client/app.js:65:0)
    at Promise (node_modules/@vuepress/core/lib/client/serverEntry.js:4:26)
    at new Promise (<anonymous>)
    at module.exports.__webpack_exports__.default.context (node_modules/@vuepress/core/lib/client/serverEntry.js:3:15)
    at /mnt/e/Temp/vuepress-test/node_modules/vue-server-renderer/build.dev.js:9391:15
    at new Promise (<anonymous>)
    at /mnt/e/Temp/vuepress-test/node_modules/vue-server-renderer/build.dev.js:9353:14
    at Object.renderToString (/mnt/e/Temp/vuepress-test/node_modules/vue-server-renderer/build.dev.js:9529:9)
    at Build.renderPage (/mnt/e/Temp/vuepress-test/node_modules/@vuepress/core/lib/node/build/index.js:156:34)
    at Build.render (/mnt/e/Temp/vuepress-test/node_modules/@vuepress/core/lib/node/build/index.js:94:33)

Other relevant information

  • Your OS: Ubuntu on WSL (Windows 10 Pro 1809)
  • Node.js version: 11.6.0
  • Browser version: Chrome latest
  • Is this a global or local install? Local
  • Which package manager did you use for the install? yarn
  • Does this issue occur when all plugins are disabled? yes
@ulivz ulivz added type: bug Something isn't working priority: high High priority issue labels Mar 31, 2019
@ulivz ulivz closed this as completed in 5e12b49 Mar 31, 2019
@ulivz
Copy link
Member

ulivz commented Mar 31, 2019

Fixed at out at 1.0.0-alpha.46.

@butameron
Copy link
Author

@ulivz thank you. it works fine.

@geelato
Copy link

geelato commented May 27, 2019

@ulivz
How to fix it? I have a same error while use third lib(vue-context.js).

"dependencies": {
"ant-design-vue": "^1.3.8",
"axios": "^0.19.0-beta.1",
"core-js": "^2.6.5",
"lodash.get": "^4.4.2",
"lodash.pick": "^4.4.0",
"vue": "^2.6.10",
"vue-context": "^4.0.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.3.0",
"@vue/cli-plugin-eslint": "^3.3.0",
"@vue/cli-service": "^3.3.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"html-webpack-plugin": "^4.0.0-beta.4",
"less": "^3.8.1",
"less-loader": "^4.1.0",
"vue-template-compiler": "^2.5.21",
"vuepress": "^1.0.0-alpha.48"
}

ReferenceError: window is not defined
at Object.module.exports.normalMerge (node_modules/vue-context/dist/js/vue-context.js:1:222)
at webpack_require (webpack/bootstrap:25:0)
at Module. (server-bundle.js:28629:19)
at webpack_require (webpack/bootstrap:25:0)
at Module. (server-bundle.js:37162:68)
at webpack_require (webpack/bootstrap:25:0)
at Module. (server-bundle.js:27716:66)
at webpack_require (webpack/bootstrap:25:0)
at Module. (server-bundle.js:100832:18)
at webpack_require (webpack/bootstrap:25:0)
at Object. (server-bundle.js:55802:18)
at webpack_require (webpack/bootstrap:25:0)
at server-bundle.js:118:18
at Object. (server-bundle.js:121:10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high High priority issue type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants