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

ReferenceError: window is not defined #36

Closed
kaihendry opened this issue Feb 27, 2019 · 3 comments
Closed

ReferenceError: window is not defined #36

kaihendry opened this issue Feb 27, 2019 · 3 comments

Comments

@kaihendry
Copy link

I forked to https://github.com/kaihendry/vuepress-blog-boilerplate and try to deploy to netlify

11:28:53 AM: Build ready to start
11:28:56 AM: build-image version: 84aca9ba39e0ee86ba194760fbfc51a808f62543
11:28:56 AM: buildbot version: 1ac64ca11e029436ed45ac81a38b9839778ec314
11:28:57 AM: Fetching cached dependencies
11:28:57 AM: Failed to fetch cache, continuing with build
11:28:57 AM: Starting to prepare the repo for build
11:28:57 AM: No cached dependencies found. Cloning fresh repo
11:28:57 AM: git clone https://github.com/kaihendry/vuepress-blog-boilerplate
11:28:58 AM: Preparing Git Reference refs/heads/master
11:28:58 AM: Starting build script
11:28:58 AM: Installing dependencies
11:28:59 AM: Downloading and installing node v8.15.0...
11:29:00 AM: Downloading https://nodejs.org/dist/v8.15.0/node-v8.15.0-linux-x64.tar.xz...
11:29:00 AM: 
#
11:29:00 AM:                                      1.4%
11:29:00 AM: #
11:29:00 AM: ##########
11:29:00 AM:                                                              16.3%
11:29:00 AM: 
########################################
11:29:00 AM: ##                                59.2%
11:29:00 AM: 
#####################################################
11:29:00 AM: ################### 100.0%
11:29:00 AM: Computing checksum with sha256sum
11:29:00 AM: Checksums matched!
11:29:03 AM: Now using node v8.15.0 (npm v6.4.1)
11:29:04 AM: Attempting ruby version 2.3.6, read from environment
11:29:05 AM: Using ruby version 2.3.6
11:29:05 AM: Using PHP version 5.6
11:29:05 AM: Started restoring cached node modules
11:29:05 AM: Finished restoring cached node modules
11:29:05 AM: Started restoring cached yarn cache
11:29:05 AM: Finished restoring cached yarn cache
11:29:05 AM: Installing yarn at version 1.3.2
11:29:05 AM: Installing Yarn!
11:29:05 AM: > Downloading tarball...
11:29:05 AM: [1/2]: https://yarnpkg.com/downloads/1.3.2/yarn
11:29:05 AM: -v1.3.2.tar.gz --> /tmp/yarn.tar.gz.mxkTjkVH0X
11:29:05 AM:   % Total    % Received % Xferd  Ave
11:29:05 AM: rage Speed   Time    Time     Time  Current
11:29:05 AM:                                  Dloa
11:29:05 AM: d  Upload   Total   Spent    Left  Speed
11:29:05 AM:  0     0    0     0    0     0
11:29:05 AM:    0      0 --:--:-- --:
11:29:05 AM: --:-- --:--:--     0
11:29:05 AM: 
100    91  100    91    0     0
11:29:05 AM:   652      0 --:--:-- --:--:-- --:--:--   654
11:29:05 AM: 
  0     0    0     0    0     0      0
11:29:05 AM:   0 --:--:-- --:--:-- --:--:--     0
11:29:05 AM: 
  0     0    0   608    0     0   1854      0 --:--:-- --:--:-- --:--:--  3823
11:29:06 AM: 
100  865k  100  865k    0     0  1270k
11:29:06 AM:     0 --:--:-- --:--:-- --:--:-- 1270k
11:29:06 AM: [2/2]: https://yarnp
11:29:06 AM: kg.com/downloads/1.3.2/yarn-v1.3.2.tar.gz.asc --> /tmp/yarn.tar.gz.mxkTjkVH0X.asc
11:29:06 AM: 
100    95  100    95    0     0
11:29:06 AM:    2456      0 --:--:-- --:--:-- --:--:--  2456
11:29:06 AM: 
  0     0    0   612    0     0   4106
11:29:06 AM:   0 --:--:-- --:--:-- --:--:--  4106
11:29:06 AM: 1
11:29:06 AM: 00  1027
11:29:06 AM:  100  1027    0     0   5393      0 --:--:-- --:--:-- --:--:--  5393
11:29:06 AM: > Verifying integrity...
11:29:06 AM: gpg: Signature made Thu 02 Nov 2017 04:44:10 PM UTC using RSA key ID FD2497F5
11:29:06 AM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
11:29:06 AM: gpg: Note: This key has expired!
11:29:06 AM: Primary key fingerprint:
11:29:06 AM:  72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
11:29:06 AM:      Subkey fingerprint: 6A01 0C51 6600 6599 AA17  F081 46C2 130D FD24 97F5
11:29:06 AM: > GPG signature looks good
11:29:06 AM: > Extracting to ~/.yarn...
11:29:06 AM: > Adding to $PATH...
11:29:06 AM: > We've added the following to your /opt/buildhome/.profile
11:29:06 AM: > If this isn't the profile of your current shell then please add the following to your correct profile:
11:29:06 AM: export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
11:29:06 AM: 
11:29:07 AM: > Successfully installed Yarn 1.3.2! Please open another terminal where the `yarn` command will now be available.
11:29:07 AM: Installing NPM modules using Yarn version 1.3.2
11:29:08 AM: yarn install v1.3.2
11:29:08 AM: [1/4] Resolving packages...
11:29:09 AM: [2/4] Fetching packages...
11:29:20 AM: info fsevents@1.2.4: The platform "linux" is incompatible with this module.
11:29:20 AM: info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
11:29:20 AM: [3/4] Linking dependencies...
11:29:20 AM: warning "vuepress > @vuepress/core > @vue/babel-preset-app > @vue/babel-preset-jsx@1.0.0-beta.1" has unmet peer dependency "@vue/babel-helper-vue-jsx-merge-props@^0.1.0".
11:29:20 AM: warning "vuepress > @vuepress/core > @vue/babel-preset-app > @vue/babel-preset-jsx > @vue/babel-plugin-transform-vue-jsx@1.0.0-beta.1" has incorrect peer dependency "@vue/babel-helper-vue-jsx-merge-props@^0.1.0".
11:29:20 AM: warning "vuepress > @vuepress/core > mini-css-extract-plugin > schema-utils > ajv-errors@1.0.1" has unmet peer dependency "ajv@>=5.0.0".
11:29:24 AM: [4/4] Building fresh packages...
11:29:24 AM: Done in 16.71s.
11:29:25 AM: NPM modules installed using Yarn
11:29:25 AM: Started restoring cached go cache
11:29:25 AM: Finished restoring cached go cache
11:29:25 AM: unset GOOS;
11:29:25 AM: unset GOARCH;
11:29:25 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
11:29:25 AM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
11:29:25 AM: go version >&2;
11:29:25 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
11:29:25 AM: go version go1.10 linux/amd64
11:29:25 AM: Installing missing commands
11:29:25 AM: Verify run directory
11:29:25 AM: Executing user command: vuepress build docs
11:29:26 AM: wait Extracting site metadata...
11:29:26 AM: tip Apply theme @vuepress/theme-default
11:29:26 AM: tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
11:29:26 AM: tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
11:29:26 AM: tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
11:29:26 AM: tip Apply plugin @vuepress/google-analytics (i.e. "@vuepress/plugin-google-analytics") ...
11:29:26 AM: tip Apply plugin rss (i.e. "vuepress-plugin-rss") ...
11:29:28 AM: [03:29:28] Compiling Client
11:29:28 AM: [03:29:28] Compiling Server
11:29:37 AM: [03:29:37] Compiled Server in 9s
11:29:43 AM: [03:29:43] Compiled Client in 15s
11:29:43 AM: wait Rendering static HTML...
11:29:43 AM: 
11:29:43 AM: 
11:29:43 AM: Rendering page: /
11:29:43 AM: ReferenceError: window is not defined
11:29:43 AM:     at inject (server-bundle.js:6630:8)
11:29:43 AM:     at server-bundle.js:7125:9
11:29:43 AM:     at Array.forEach (<anonymous>)
11:29:43 AM:     at createApp (server-bundle.js:7123:19)
11:29:43 AM:     at module.exports.__webpack_exports__.default (server-bundle.js:7164:22)
11:29:43 AM:     at new Promise (<anonymous>)
11:29:43 AM:     at new F (server-bundle.js:174:28)
11:29:43 AM:     at module.exports.__webpack_exports__.default (server-bundle.js:7163:10)
11:29:43 AM:     at /opt/build/repo/node_modules/vue-server-renderer/build.js:8456:15
11:29:43 AM:     at new Promise (<anonymous>)
11:29:43 AM:     at /opt/build/repo/node_modules/vue-server-renderer/build.js:8418:14
11:29:43 AM:     at Object.renderToString (/opt/build/repo/node_modules/vue-server-renderer/build.js:8594:9)
11:29:43 AM:     at renderPage (/opt/build/repo/node_modules/@vuepress/core/lib/build.js:151:29)
11:29:43 AM:     at build (/opt/build/repo/node_modules/@vuepress/core/lib/build.js:76:26)
11:29:43 AM:     at <anonymous>
11:29:43 AM: 
11:29:43 AM: Rendering page: /learn/
11:29:43 AM: ReferenceError: window is not defined
11:29:43 AM:     at inject (server-bundle.js:6630:8)
11:29:43 AM:     at server-bundle.js:7125:9
11:29:43 AM:     at Array.forEach (<anonymous>)
11:29:43 AM:     at createApp (server-bundle.js:7123:19)
11:29:43 AM:     at module.exports.__webpack_exports__.default (server-bundle.js:7164:22)
11:29:43 AM:     at new Promise (<anonymous>)
11:29:43 AM:     at new F (server-bundle.js:174:28)
11:29:43 AM:     at module.exports.__webpack_exports__.default (server-bundle.js:7163:10)
11:29:43 AM:     at /opt/build/repo/node_modules/vue-server-renderer/build.js:8456:15
11:29:43 AM:     at new Promise (<anonymous>)
11:29:43 AM:     at /opt/build/repo/node_modules/vue-server-renderer/build.js:8418:14
11:29:43 AM:     at Object.renderToString (/opt/build/repo/node_modules/vue-server-renderer/build.js:8594:9)
11:29:43 AM:     at renderPage (/opt/build/repo/node_modules/@vuepress/core/lib/build.js:151:29)
11:29:43 AM:     at build (/opt/build/repo/node_modules/@vuepress/core/lib/build.js:76:26)
11:29:43 AM:     at <anonymous>
11:29:43 AM: 
11:29:43 AM: Rendering page: /404.html
11:29:43 AM: ReferenceError: window is not defined
11:29:43 AM:     at inject (server-bundle.js:6630:8)
11:29:43 AM:     at server-bundle.js:7125:9
11:29:43 AM:     at Array.forEach (<anonymous>)
11:29:43 AM:     at createApp (server-bundle.js:7123:19)
11:29:43 AM:     at module.exports.__webpack_exports__.default (server-bundle.js:7164:22)
11:29:43 AM:     at new Promise (<anonymous>)
11:29:43 AM:     at new F (server-bundle.js:174:28)
11:29:43 AM:     at module.exports.__webpack_exports__.default (server-bundle.js:7163:10)
11:29:43 AM:     at /opt/build/repo/node_modules/vue-server-renderer/build.js:8456:15
11:29:43 AM:     at new Promise (<anonymous>)
11:29:43 AM:     at /opt/build/repo/node_modules/vue-server-renderer/build.js:8418:14
11:29:43 AM:     at Object.renderToString (/opt/build/repo/node_modules/vue-server-renderer/build.js:8594:9)
11:29:43 AM:     at renderPage (/opt/build/repo/node_modules/@vuepress/core/lib/build.js:151:29)
11:29:43 AM:     at build (/opt/build/repo/node_modules/@vuepress/core/lib/build.js:76:26)
11:29:43 AM:     at <anonymous>
11:29:43 AM: 
11:29:43 AM: 
11:29:43 AM: RSS has been generated!
11:29:43 AM: success Generated static files in public.
11:29:43 AM: Caching artifacts
11:29:43 AM: Started saving node modules
11:29:43 AM: Finished saving node modules
11:29:43 AM: Started saving yarn cache
11:29:43 AM: Finished saving yarn cache
11:29:43 AM: Started saving pip cache
11:29:43 AM: Finished saving pip cache
11:29:43 AM: Started saving emacs cask dependencies
11:29:43 AM: Finished saving emacs cask dependencies
11:29:43 AM: Started saving maven dependencies
11:29:43 AM: Finished saving maven dependencies
11:29:43 AM: Started saving boot dependencies
11:29:43 AM: Finished saving boot dependencies
11:29:43 AM: Started saving go dependencies
11:29:43 AM: Finished saving go dependencies
11:29:44 AM: Cached node version v8.15.0
11:29:44 AM: Build script success
11:29:44 AM: Failing build: Failed to build site
11:29:44 AM: failed during stage 'building site': Deploy directory 'docs/.vuepress/dist' does not exist
11:29:44 AM: Finished processing build request in 48.095245028s
11:29:44 AM: Shutting down logging, 0 messages pending
@bencodezen
Copy link
Owner

@kaihendry Thanks for reporting this! So the failure to deploy looks like is happening because of a folder location error:

11:29:44 AM: failed during stage 'building site': Deploy directory 'docs/.vuepress/dist' does not exist

We need to point netlify at /public in order for it to deploy properly. Let me know if that works!

@kaihendry
Copy link
Author

Thanks! I have the test site working https://browserinabox.com/

...but why go against vuepress convention?

@bencodezen
Copy link
Owner

@kaihendry Great question. I have debated it mentally a few times and settled on going to the more generic SPA convention of putting it in the root folder since the .vuepress folder is hidden by default on most people's Window Explorer / Finder. However, the confusion here may be honestly letting it just follow the convention.

Glad everything worked out!

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