jlengstorf / netlify-plugin-gatsby-cache

185 stars 21 forks source link

TypeError: Cannot read property 'build' of undefined​ #7

Closed moop-moop closed 4 years ago

moop-moop commented 4 years ago

Trying out the plugin on Netlify. Not sure if I am missing something simple or something else deeper going on here.

8:17:35 PM: Build ready to start 8:17:37 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774 8:17:37 PM: build-image tag: v3.3.7 8:17:37 PM: buildbot version: 10926ec3478dd6c0bfc84e15d24de329bb1b357f 8:17:37 PM: Fetching cached dependencies 8:17:37 PM: Starting to download cache of 254.9KB 8:17:37 PM: Finished downloading cache in 106.309483ms 8:17:37 PM: Starting to extract cache 8:17:37 PM: Failed to fetch cache, continuing with build 8:17:37 PM: Starting to prepare the repo for build 8:17:38 PM: No cached dependencies found. Cloning fresh repo 8:17:38 PM: git clone https://github.com/UWHealth/gatsby-starter-gcn 8:17:39 PM: Preparing Git Reference refs/heads/test 8:17:40 PM: Starting build script 8:17:40 PM: Installing dependencies 8:17:41 PM: v10.19.0 is already installed. 8:17:42 PM: Now using node v10.19.0 (npm v6.13.4) 8:17:42 PM: Attempting ruby version 2.6.2, read from environment 8:17:44 PM: Using ruby version 2.6.2 8:17:45 PM: Using PHP version 5.6 8:17:45 PM: Started restoring cached node modules 8:17:45 PM: Finished restoring cached node modules 8:17:45 PM: Installing NPM modules using NPM version 6.13.4 8:18:45 PM: > sharp@0.23.4 install /opt/build/repo/node_modules/sharp 8:18:45 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) 8:18:46 PM: info 8:18:46 PM: sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz 8:18:48 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js 8:18:48 PM: > node -e "try{require('./postinstall')}catch(e){}" 8:18:49 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library! 8:18:49 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 8:18:49 PM: > https://opencollective.com/core-js 8:18:49 PM: > https://www.patreon.com/zloirock 8:18:49 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -) 8:18:49 PM: > core-js-pure@3.6.4 postinstall /opt/build/repo/node_modules/core-js-pure 8:18:49 PM: > node -e "try{require('./postinstall')}catch(e){}" 8:18:49 PM: > gatsby-telemetry@1.1.55 postinstall /opt/build/repo/node_modules/gatsby-telemetry 8:18:49 PM: > node src/postinstall.js || true 8:18:49 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin 8:18:49 PM: > node lib/install.js 8:18:50 PM: ✔ cwebp pre-build test passed successfully 8:18:50 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg 8:18:50 PM: > node lib/install.js 8:18:51 PM: ✔ mozjpeg pre-build test passed successfully 8:18:51 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin 8:18:51 PM: > node lib/install.js 8:18:51 PM: ✔ pngquant pre-build test passed successfully 8:18:51 PM: > gatsby-cli@2.10.10 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli 8:18:51 PM: > node scripts/postinstall.js 8:18:52 PM: > gatsby@2.19.43 postinstall /opt/build/repo/node_modules/gatsby 8:18:52 PM: > node scripts/postinstall.js 8:18:56 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents): 8:18:56 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 8:18:56 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/chokidar/node_modules/fsevents): 8:18:56 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 8:18:56 PM: added 2912 packages from 1550 contributors and audited 34147 packages in 70.215s 8:19:00 PM: 114 packages are looking for funding 8:19:00 PM: run npm fund for details 8:19:00 PM: found 131 vulnerabilities (78 low, 25 moderate, 28 high) 8:19:00 PM: run npm audit fix to fix them, or npm audit for details 8:19:00 PM: NPM modules installed 8:19:00 PM: Started restoring cached go cache 8:19:00 PM: Finished restoring cached go cache 8:19:00 PM: unset GOOS; 8:19:00 PM: unset GOARCH; 8:19:00 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64'; 8:19:00 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}"; 8:19:00 PM: go version >&2; 8:19:00 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env'; 8:19:00 PM: go version go1.12 linux/amd64 8:19:00 PM: Installing missing commands 8:19:00 PM: Verify run directory 8:19:04 PM: Resolved Netlify Build version tag "latest" to "0.1.112" 8:19:04 PM: Netlify Build not installed. Installing Netlify Build version 0.1.112 8:19:23 PM: npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. 8:19:33 PM: /opt/buildhome/.nvm/versions/node/v12.16.1/bin/netlify-build -> /opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/core/bin.js 8:19:34 PM: > core-js@2.6.11 postinstall /opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/node_modules/babel-runtime/node_modules/core-js 8:19:34 PM: > node -e "try{require('./postinstall')}catch(e){}" 8:19:34 PM: > core-js@3.6.4 postinstall /opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/node_modules/core-js 8:19:34 PM: > node -e "try{require('./postinstall')}catch(e){}" 8:19:34 PM: + @netlify/build@0.1.112 8:19:34 PM: added 580 packages from 309 contributors in 29.394s 8:19:35 PM: Starting Netlify Build... 8:19:38 PM: ​ 8:19:38 PM: ❯ Starting Netlify Build v0.1.112 8:19:38 PM: https://github.com/netlify/build 8:19:38 PM: ​ 8:19:38 PM: ❯ Flags 8:19:38 PM: siteId: a49ad1a6-0175-4463-8047-b0226814537a 8:19:38 PM: ​ 8:19:38 PM: ❯ Current directory 8:19:38 PM: /opt/build/repo 8:19:38 PM: ​ 8:19:38 PM: ❯ Config file 8:19:38 PM: /opt/build/repo/netlify.toml 8:19:38 PM: ​ 8:19:38 PM: ❯ Context 8:19:38 PM: production 8:19:38 PM: ​ 8:19:40 PM: ❯ Loading plugins 8:19:40 PM: - netlify-plugin-gatsby-cache@0.1.2 8:19:40 PM: ​ 8:19:40 PM: ❯ Running Netlify Build Lifecycle 8:19:40 PM: Found 2 commands. Let's do this! 8:19:40 PM: 8:19:40 PM: ┌────────────────────────────────────────────────────────────────┐ 8:19:40 PM: │ 1. Running onPreBuild command from netlify-plugin-gatsby-cache │ 8:19:40 PM: └────────────────────────────────────────────────────────────────┘ 8:19:40 PM: ​ 8:19:40 PM: ​ 8:19:40 PM: ┌─────────────────────────────────────────────────────┐ 8:19:40 PM: │ Plugin "netlify-plugin-gatsby-cache" internal error │ 8:19:40 PM: └─────────────────────────────────────────────────────┘ 8:19:40 PM: ​ 8:19:40 PM: ❯ Error message 8:19:40 PM: TypeError: Cannot read property 'build' of undefined​ 8:19:40 PM: ​ 8:19:40 PM: ❯ Plugin details 8:19:40 PM: ID: netlify-plugin-gatsby-cache 8:19:40 PM: Version: 0.1.2 8:19:40 PM: Repository: git+https://github.com/jlengstorf/netlify-plugin-gatsby-cache.git 8:19:40 PM: npm link: https://www.npmjs.com/package/netlify-plugin-gatsby-cache 8:19:40 PM: Report issues: https://github.com/jlengstorf/netlify-plugin-gatsby-cache/issues​ 8:19:40 PM: ​ 8:19:40 PM: ❯ Error location 8:19:40 PM: In "onPreBuild" event in npm package "netlify-plugin-gatsby-cache" 8:19:40 PM: at getNetlifyCacheDirs (/opt/build/repo/node_modules/netlify-plugin-gatsby-cache/index.js:6:41) 8:19:40 PM: at preBuild (/opt/build/repo/node_modules/netlify-plugin-gatsby-cache/index.js:25:11) 8:19:40 PM: at Object.run (/opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/plugins/child/main.js:82:9) 8:19:40 PM: at handleEvent (/opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/plugins/child/main.js:63:43) 8:19:40 PM: at getEventsFromParent (/opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/plugins/child/main.js:59:61) 8:19:40 PM: at process.on (/opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/plugins/ipc.js:80:15) 8:19:40 PM: at process.emit (events.js:198:13) 8:19:40 PM: at emit (internal/child_process.js:832:12) 8:19:40 PM: at process._tickCallback (internal/process/next_tick.js:63:19) 8:19:40 PM: ​ 8:19:41 PM: Caching artifacts 8:19:41 PM: Started saving node modules 8:19:41 PM: Finished saving node modules 8:19:41 PM: Started saving pip cache 8:19:41 PM: Finished saving pip cache 8:19:41 PM: Started saving emacs cask dependencies 8:19:41 PM: Finished saving emacs cask dependencies 8:19:41 PM: Started saving maven dependencies 8:19:41 PM: Finished saving maven dependencies 8:19:41 PM: Started saving boot dependencies 8:19:41 PM: Finished saving boot dependencies 8:19:41 PM: Started saving go dependencies 8:19:41 PM: Finished saving go dependencies 8:19:48 PM: Error running command: Build script returned non-zero exit code: 1 8:19:48 PM: Failing build: Failed to build site 8:19:49 PM: failed during stage 'building site': Build script returned non-zero exit code: 1 8:19:49 PM: Finished processing build request in 2m11.438131119s

jlengstorf commented 4 years ago

hey, thanks for reporting this! definitely doesn't look right

@ehmicky is this coming from the cache utils? it appears to be happening outside of the plugin

moop-moop commented 4 years ago

I think I was mistakenly using an older version of the plugin. I’ve updated and will confirm.

The code seems to have changed significantly from the version I initially used.

moop-moop commented 4 years ago

My error. Using netlify-plugin-gatsby-cache@0.2.1 versus netlify-plugin-gatsby-cache@0.1.2 fixed the problem.

jlengstorf commented 4 years ago

ah, great that it's working! thanks for following up!