Munter / netlify-plugin-hashfiles

Netlify build plugin to get optimal file caching with hashed file names and immutable cache headers
BSD 3-Clause "New" or "Revised" License
32 stars 2 forks source link

Directory separator missing when loading assets #36

Open codedge opened 4 years ago

codedge commented 4 years ago

Hi,

there is a directory separator / missing between public/<next-directory>:

12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/style.template.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_variables.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicconfig/css/_override.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_core/_normalize.scss'

Error output

12:06:02 PM: Build ready to start
12:06:04 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
12:06:04 PM: build-image tag: v3.3.7
12:06:04 PM: buildbot version: 134ec431c6a3ff76e87cc4dc34007fe13842272f
12:06:04 PM: Fetching cached dependencies
12:06:04 PM: Starting to download cache of 266.6MB
12:06:05 PM: Finished downloading cache in 1.269744491s
12:06:05 PM: Starting to extract cache
12:06:14 PM: Finished extracting cache in 8.73188109s
12:06:14 PM: Finished fetching cache in 10.079092352s
12:06:14 PM: Starting to prepare the repo for build
12:06:14 PM: Preparing Git Reference refs/heads/master
12:06:16 PM: Starting build script
12:06:16 PM: Installing dependencies
12:06:17 PM: Started restoring cached node version
12:06:22 PM: Finished restoring cached node version
12:06:23 PM: v13.13.0 is already installed.
12:06:23 PM: Now using node v13.13.0 (npm v6.14.4)
12:06:24 PM: Attempting ruby version 2.6.2, read from environment
12:06:25 PM: Using ruby version 2.6.2
12:06:25 PM: Using PHP version 5.6
12:06:25 PM: Installing Hugo 0.69.0
12:06:25 PM: Hugo Static Site Generator v0.69.0-4205844B/extended linux/amd64 BuildDate: 2020-04-10T09:16:58Z
12:06:25 PM: Started restoring cached go cache
12:06:25 PM: Finished restoring cached go cache
12:06:25 PM: unset GOOS;
12:06:25 PM: unset GOARCH;
12:06:25 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
12:06:25 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
12:06:25 PM: go version >&2;
12:06:25 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
12:06:25 PM: go version go1.12 linux/amd64
12:06:25 PM: Installing missing commands
12:06:25 PM: Verify run directory
12:06:28 PM: Resolved Netlify Build version tag "latest" to "0.3.6"
12:06:28 PM: Netlify Build not installed. Installing Netlify Build version 0.3.6
12:06:50 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
12:06:50 PM: + @netlify/build@0.3.6
12:06:50 PM: added 583 packages from 324 contributors in 21.881s
12:06:51 PM: Starting Netlify Build...
12:06:53 PM: ​
12:06:53 PM: ┌─────────────────────────────┐
12:06:53 PM: │        Netlify Build        │
12:06:53 PM: └─────────────────────────────┘
12:06:53 PM: ​
12:06:53 PM: ❯ Version
12:06:53 PM:   @netlify/build 0.3.6
12:06:53 PM: ​
12:06:53 PM: ❯ Flags
12:06:53 PM:   mode: buildbot
12:06:53 PM: ​
12:06:53 PM: ❯ Current directory
12:06:53 PM:   /opt/build/repo
12:06:53 PM: ​
12:06:53 PM: ❯ Config file
12:06:53 PM:   /opt/build/repo/netlify.toml
12:06:53 PM: ​
12:06:53 PM: ❯ Context
12:06:53 PM:   production
12:06:53 PM: ​
12:06:53 PM: ❯ Installing plugins
12:06:53 PM:    - netlify-plugin-checklinks
12:06:53 PM:    - netlify-plugin-hashfiles
12:06:53 PM:    - netlify-plugin-no-more-404
12:07:15 PM: ​
12:07:15 PM: ❯ Loading plugins
12:07:18 PM:    - netlify-plugin-checklinks@4.0.1
12:07:18 PM:    - netlify-plugin-hashfiles@4.0.1
12:07:18 PM:    - netlify-plugin-no-more-404@0.0.14
12:07:18 PM: ​
12:07:18 PM: ┌──────────────────────────────────────────────────────────────────┐
12:07:18 PM: │ 1. build.lifecycle.onBuild command from netlify.toml config file │
12:07:18 PM: └──────────────────────────────────────────────────────────────────┘
12:07:18 PM: ​
12:07:18 PM: $ hugo --gc --minify
12:07:19 PM: Building sites …
12:07:19 PM:                    | EN
12:07:19 PM: -------------------+------
12:07:19 PM:   Pages            |  14
12:07:19 PM:   Paginator pages  |   0
12:07:19 PM:   Non-page files   |   0
12:07:19 PM:   Static files     | 113
12:07:19 PM:   Processed images |   0
12:07:19 PM:   Aliases          |   3
12:07:19 PM:   Sitemaps         |   1
12:07:19 PM:   Cleaned          |   0
12:07:19 PM: Total in 271 ms
12:07:19 PM: ​
12:07:19 PM: (build.lifecycle.onBuild completed in 322ms)
12:07:19 PM: ​
12:07:19 PM: ┌───────────────────────────────────────────────────────┐
12:07:19 PM: │ 2. onPostBuild command from netlify-plugin-checklinks │
12:07:19 PM: └───────────────────────────────────────────────────────┘
12:07:19 PM: ​
12:07:21 PM: ..................................................................................................
12:07:21 PM:   98 tests
12:07:21 PM:   98 passed
12:07:21 PM: ​
12:07:21 PM: (netlify-plugin-checklinks onPostBuild completed in 1.9s)
12:07:21 PM: ​
12:07:21 PM: ┌──────────────────────────────────────────────────────┐
12:07:21 PM: │ 3. onPostBuild command from netlify-plugin-hashfiles │
12:07:21 PM: └──────────────────────────────────────────────────────┘
12:07:21 PM: ​
12:07:23 PM:  ✔ 0.002 secs: logEvents
12:07:23 PM:  ✔ 0.287 secs: loadAssets
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/style.template.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_variables.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicconfig/css/_override.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_core/_normalize.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_core/_base.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_dynamic-to-top.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_core/_layout.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_page/_index.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_page/_single.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_toc.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_code.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_instagram.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_admonition.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_echarts.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_bilibili.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_footer.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_single/_comment.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_page/_special.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_page/_archive.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_archive/_terms.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_archive/_tags.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_page/_home.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_home/_summary.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_page/_404.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_header.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_footer.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_partial/_pagination.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'publicthemes/LoveIt/assets/css/_core/_media.scss'
12:07:23 PM:  ⚠ WARN: ENOENT: no such file or directory, open 'src/js/theme.js'
12:07:23 PM:  ✔ 1.515 secs: populate
12:07:23 PM:  ✔ 0.192 secs: moveAssetsInOrder
12:07:23 PM:  ✔ 0.195 secs: moveAssetsInOrder
12:07:23 PM: ​
12:07:23 PM: ┌──────────────────────────────────────────────────┐
12:07:23 PM: │ Plugin "netlify-plugin-hashfiles" internal error │
12:07:23 PM: └──────────────────────────────────────────────────┘
12:07:23 PM: ​
12:07:23 PM:   Error message
12:07:23 PM:   UnhandledRejection: a promise was rejected but not handled: Error: ENOENT: no such file or directory, unlink '/opt/build/repo/public/lib/webfonts/fa-brands-400.eot'
12:07:23 PM:   Error: ENOENT: no such file or directory, unlink '/opt/build/repo/public/lib/webfonts/fa-brands-400.eot'
12:07:23 PM: ​
12:07:23 PM:   Plugin details
12:07:23 PM:   ID:             netlify-plugin-hashfiles
12:07:23 PM:   Version:        4.0.1
12:07:23 PM:   Repository:     git://github.com/munter/netlify-plugin-hashfiles.git
12:07:23 PM:   npm link:       https://www.npmjs.com/package/netlify-plugin-hashfiles
12:07:23 PM:   Report issues:  https://github.com/munter/netlify-plugin-hashfiles/issues
12:07:23 PM: ​
12:07:23 PM:   Error location
12:07:23 PM:   In "onPostBuild" event in npm package "netlify-plugin-hashfiles"
12:07:23 PM: ​
12:07:23 PM:   Error properties
12:07:23 PM:   {
12:07:23 PM:     errno: -2,
12:07:23 PM:     code: 'ENOENT',
12:07:23 PM:     syscall: 'unlink',
12:07:23 PM:     path: '/opt/build/repo/public/lib/webfonts/fa-brands-400.eot'
12:07:23 PM:   }
12:07:23 PM: ​
12:07:24 PM: Caching artifacts
12:07:24 PM: Started saving node modules
12:07:24 PM: Finished saving node modules
12:07:24 PM: Started saving pip cache
12:07:24 PM: Finished saving pip cache
12:07:24 PM: Started saving emacs cask dependencies
12:07:24 PM: Finished saving emacs cask dependencies
12:07:24 PM: Started saving maven dependencies
12:07:24 PM: Finished saving maven dependencies
12:07:24 PM: Started saving boot dependencies
12:07:24 PM: Finished saving boot dependencies
12:07:24 PM: Started saving go dependencies
12:07:24 PM: Finished saving go dependencies
12:07:24 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
12:07:24 PM: Error running command: Build script returned non-zero exit code: 1
12:07:24 PM: Failing build: Failed to build site
12:07:24 PM: Shutting down logging, 1 messages pending
Munter commented 4 years ago

Thanks for reporting this.

I'll need to understand your setup a bit more to understand how to recreate this. Could you show me your build > publish config from your netlify config file and an ls -1 from that same publish directory? I just need to make sure I'm recreating this setup correctly.

I'm assuming I'm missing a trailing slash somewhere

codedge commented 4 years ago

My netlify.toml looks like this:

[context.production.environment]
HUGO_VERSION = "0.69.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "false"

NODE_VERSION = "13"

[build]
publish = "public"
command = "hugo --gc --minify"

[[headers]]
  for = "/*"
  [headers.values]
    X-Frame-Options = "DENY"
    X-XSS-Protection = "1; mode=block"

[[plugins]]
package = "netlify-plugin-debug-cache"

[[plugins]]
package = "netlify-plugin-checklinks"

[[plugins]]
package = "netlify-plugin-hashfiles"

#[[plugins]]
#package = "netlify-plugin-subfont"

[[plugins]]
package = "netlify-plugin-no-more-404"

  [plugins.inputs]
  cacheKey = "codedge-blog"

So the publish directory is public.

The ls -1 from public from my local machine looks like this:

22:44:40 ➜ ls -1                                                                                                                                                         (master|✚2…)
404.html
about
android-chrome-192x192.png
android-chrome-512x512.png
apple-touch-icon.png
categories
css
favicon-16x16.png
favicon-32x32.png
favicon.ico
index.html
index.xml
js
legal-notice
lib
logo.png
mstile-150x150.png
page
posts
robots.txt
safari-pinned-tab.svg
sitemap.xml
svg
tags
uses
Munter commented 4 years ago

Thank you. It's about time I figure out a proper test setup to recreate scenarios like these. This will help me