11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.93k stars 491 forks source link

Moving install to new machine causes YAML error #1707

Closed davidmead closed 3 years ago

davidmead commented 3 years ago

Describe the bug I have had version 9 (global install, I think) running on a laptop without issue. Got a new laptop and did a clean install for the latest version (local install). Pulled down my files from GitHub and put into folder on new laptop.

Now get a YAML exception when running --serve

YAMLException was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post

Expected behavior I expected by just adding my old files from GitHub into the correct folder I should be able to build . I can view and navigate the site using localhost just fine.

Environment:

Additional context I have tried not including the old package.json etc. that are created when installing Eleventy but it doesn't make any difference.

pdehaan commented 3 years ago

@davidmead Is your GitHub repo public? I'm curious what this YAML frontmatter might be.

davidmead commented 3 years ago

@pdehaan I just made it public. Any help appreciated.

https://github.com/davidmead/eleventy-sample

pdehaan commented 3 years ago

Interesting early results... After git cloneing your repo and building locally, I get the following (using @11ty/eleventy v0.9.0):

npx eleventy
# ...
Copied 2 items and Processed 219 files in 1.24 seconds (5.7ms each, v0.9.0)

If I install the latest stable @11ty/eleventy (v0.12.1), I get the following:

npm i @11ty/eleventy@latest
npx eleventy
# ...
Copied 60 files / Wrote 219 files in 0.96 seconds (4.4ms each, v0.12.1)

So both completed successfully for me (with some confusing differences between number of copied files).

I'm on macOS 10.15.7 (Catalina), although I don't imagine that'd make a difference. I'll keep poking at it and see if I can find a file with that specified layout on line 12 and see what file may be giving that error.

Are you sure all your latest changes are in sync w/ GitHub and you don't have any uncommitted code locally that would be giving the error?

pdehaan commented 3 years ago

Re: "YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:",

Nothing interesting in these posts frontmatter that would imply some error in processing them:

git grep -irn "layout: layouts/layout-post" . | grep ":12:"

posts/2019-12-14-people-want-own-the-content.md:12:layout: layouts/layout-post
posts/2019-12-16-podcast-bankruptcy.md:12:layout: layouts/layout-post
posts/2020-01-19-capturing-something.md:12:layout: layouts/layout-post

Of course, it's possible that the line number might be misleading, in which case we'd need to write some script that tries verifying all frontmatter in your templates. But the fact that both Eleventy v0.9 and v0.12 are working for me locally, that may not help answer anything since Eleventy seems to be processing the files A-OK over here.

davidmead commented 3 years ago

Thanks for taking a look.

This error gets thrown when I create a new .md file in the posts folder and I try to create a post.

  1. Open Coda2 and start a new document
  2. Use Textexpander to paste in front matter
---
title:
description:
summary:

date: yyyy-mm-ddT00:00:01.00-05:00

tags:
  - post
  - tag

layout: layouts/layout-post
---
your post goes here
  1. Save as test2.md in the posts folder
  2. Open Terminal
  3. Type cd blog
  4. Type npx @11ty/eleventy --serve

I get the following in Terminal...

Problem writing Eleventy templates: (more in DEBUG output)
> can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
    layout: layouts/layout-post
          ^

`YAMLException` was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post
              ^
        at generateError (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
        at throwError (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
        at readBlockMapping (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:1073:9)
        at composeNode (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)
        at readDocument (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:1525:3)
        at loadDocuments (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5)
        at load (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19)
        at Object.safeLoad (/Users/davidmead/blog/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10)
        at module.exports (/Users/davidmead/blog/node_modules/gray-matter/lib/parse.js:12:17)
        at parseMatter (/Users/davidmead/blog/node_modules/gray-matter/index.js:109:17)
Wrote 0 files in 0.22 seconds (v0.12.1)

This is the exact same way I've been doing it in version 9 and no issues.

pdehaan commented 3 years ago

Interestinger... I tried that in v0.12 and I get a different error due to that not being a valid date:

npx @11ty/eleventy
Problem writing Eleventy templates: (more in DEBUG output)
> date front matter value (yyyy-mm-ddT00:00:01.00-05:00) is invalid for ./posts/draft.md

`Error` was thrown:
    Error: date front matter value (yyyy-mm-ddT00:00:01.00-05:00) is invalid for ./posts/draft.md
        at Template.getMappedDate (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:689:19)
        at async Template.addPageDate (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:277:19)
        at async Template.getData (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:258:20)
        at async Template.getTemplateMapEntries (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:744:16)
        at async TemplateMap.add (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateMap.js:32:21)
        at async Promise.all (index 86)
        at async TemplateWriter._createTemplateMap (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateWriter.js:169:5)
        at async TemplateWriter.writeTemplates (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateWriter.js:203:5)
        at async TemplateWriter.write (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateWriter.js:254:25)
        at async Eleventy.write (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Eleventy.js:743:13)
Copied 1 file / Wrote 0 files in 0.28 seconds (v0.12.1)

But that also fails for me in v0.9.x:

npx @11ty/eleventy
Problem writing Eleventy templates: (more in DEBUG output)
> date front matter value (yyyy-mm-ddT00:00:01.00-05:00) is invalid for ./posts/draft.md

`Error` was thrown:
    Error: date front matter value (yyyy-mm-ddT00:00:01.00-05:00) is invalid for ./posts/draft.md
        at Template.getMappedDate (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:613:19)
        at async Template.addPageDate (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:256:19)
        at async Template.getData (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:237:20)
        at async Template.getTemplateMapEntries (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Template.js:668:16)
        at async TemplateMap.add (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateMap.js:32:21)
        at async Promise.all (index 86)
        at async TemplateWriter._createTemplateMap (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateWriter.js:123:3)
        at async TemplateWriter.write (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/TemplateWriter.js:155:3)
        at async Eleventy.write (/private/tmp/eleventy-sample/node_modules/@11ty/eleventy/src/Eleventy.js:428:13)
Copied 1 item and Processed 0 files in 0.34 seconds (v0.9.0)

Probably easiest workaround is to set a valid date, or comment that line out in your TextExpander snippet, or set it to one of the valid values from https://www.11ty.dev/docs/dates/#setting-a-content-date-in-front-matter (ie: "Created").

pdehaan commented 3 years ago

Two other ideas while I have this tab open still...

I don't think your posts need a date frontmatter value since you're specifying the date in the filename (ie: /posts/2019-12-04-handling-broken-links.md).

And another workaround for the invalid date format (although you're oddly seeing a different error than me) is to automatically insert the current date via TextExpander using something like https://textexpander.com/kb/general/how-can-enter-todays-date-with-a-textexpander-snippet/.

davidmead commented 3 years ago

Sorry. Should've mentioned. I edit that date so yyyy-mm-dd is 2021-03-21 before I post. I do this as I run into the issue of posts being "a day behind" due to UTC - https://www.11ty.dev/docs/dates/#dates-off-by-one-day.

I went this route as I couldn't get created: to work properly and Last Modified: changes all the posts dates to the same thing every time I run a --serve.

It's strange that you aren't seeing the same error. Did you use the package-lock.json, package.json, and node_modules folder from my repo or the ones created by the v12 install?

Wondering if that has anything to do with it.

davidmead commented 3 years ago

I will look at that TextExpander date. Didn't know that and seems handy. Thanks.

pdehaan commented 3 years ago

OK, so if I clone your repo, and add a new /posts/draft.md file with the following:

---
title:
description:
summary:

date: 2021-03-24T00:00:01.00-05:00

tags:
  - post
  - tag

layout: layouts/layout-post
---
your post goes here

And then build using npx @11ty/eleventy, it seems to build fine on v0.9.0:

npx @11ty/eleventy
# ...
Copied 2 items and Processed 222 files in 1.05 seconds (4.7ms each, v0.9.0)

# Here we can confirm that @11ty/eleventy is using the old 0.9.0 build instead of the latest 0.12.1.
npm outdated
Package                    Current  Wanted  Latest  Location
@11ty/eleventy               0.9.0   0.9.0  0.12.1  eleventy-sample
@11ty/eleventy-plugin-rss    1.0.7   1.1.1   1.1.1  eleventy-sample
moment                      2.24.0  2.29.1  2.29.1  eleventy-sample

# And a relatively clean Git history.
git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore
        _site/27/
        _site/posts/draft/
        _site/tags/tag/
        posts/draft.md

nothing added to commit but untracked files present (use "git add" to track)

But oddly still works fine for me after upgrading Eleventy via npm i @11ty/eleventy@latest:

npm i @11ty/eleventy@latest

npm outdated
Package                    Current  Wanted  Latest  Location
@11ty/eleventy-plugin-rss    1.0.7   1.1.1   1.1.1  eleventy-sample
moment                      2.24.0  2.29.1  2.29.1  eleventy-sample

npx @11ty/eleventy
# ...
Copied 60 files / Wrote 222 files in 0.98 seconds (4.4ms each, v0.12.1)

# But now my Git status is incredibly large due to all the ./node_modules/ churn, with about 6376 changed files.
git status | wc -l # 6376
davidmead commented 3 years ago

How can I install version 9 on my new laptop? I am not that familiar with Git or Terminal.

Thinking I'll try 9 on my new laptop and see if that works, then update to latest. Maybe it's something about the config of my laptop or I'm missing something that is on my old laptop.

pdehaan commented 3 years ago

How can I install version 9 on my new laptop?

npm i @11ty/eleventy@0.9

And for a full list of available Eleventy versions on npm, you can do the following magic:

npm info @11ty/eleventy versions --json
davidmead commented 3 years ago

OK. I can't get this to work @pdehaan.

  1. Deleted all previous folders on my new laptop
  2. Opened Terminal
  3. mkdir eleventy-sample
  4. cd eleventy-sample
  5. npm i @11ty/eleventy@0.9
  6. npm install --save-dev @11ty/eleventy
  7. npx @11ty/eleventy

This gave me a whole string of errors (see below) and ended up saying I had version 12!

Is there a way to remove Eleventy using the Terminal and start from scratch because something is wrong somewhere. If not I may just abandoned the whole thing as this is ridiculous.

Last login: Wed Mar 24 22:10:12 on ttys000
davidmead@davids-air ~ % mkdir eleventy-sample
davidmead@davids-air ~ % cd eleventy-sample
davidmead@davids-air eleventy-sample % npm i @11ty/eleventy@0.9
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated core-js@2.6.12: 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.

> core-js@2.6.12 postinstall /Users/davidmead/eleventy-sample/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> ejs@2.7.4 postinstall /Users/davidmead/eleventy-sample/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm WARN saveError ENOENT: no such file or directory, open '/Users/davidmead/eleventy-sample/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/davidmead/eleventy-sample/package.json'
npm WARN eleventy-sample No description
npm WARN eleventy-sample No repository field.
npm WARN eleventy-sample No README data
npm WARN eleventy-sample No license field.

+ @11ty/eleventy@0.9.0
added 455 packages from 428 contributors and audited 455 packages in 17.034s

17 packages are looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
davidmead@davids-air eleventy-sample % npm install --save-dev @11ty/eleventy
npm WARN saveError ENOENT: no such file or directory, open '/Users/davidmead/eleventy-sample/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/davidmead/eleventy-sample/package.json'
npm WARN eleventy-sample No description
npm WARN eleventy-sample No repository field.
npm WARN eleventy-sample No README data
npm WARN eleventy-sample No license field.

+ @11ty/eleventy@0.12.1
added 32 packages from 11 contributors, updated 1 package and audited 769 packages in 3.152s

19 packages are looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
davidmead@davids-air eleventy-sample % npx @11ty/eleventy
Wrote 0 files in 0.01 seconds (v0.12.1)
davidmead@davids-air eleventy-sample % npx @11ty/eleventy --serve
Wrote 0 files in 0.39 seconds (v0.12.1)
Watching…
[Browsersync] Access URLs:
 ---------------------------------------
       Local: http://localhost:8080
    External: http://192.168.86.250:8080
 ---------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 ---------------------------------------
[Browsersync] Serving files from: _site
File added: test123.md.html
Problem writing Eleventy templates: (more in DEBUG output)
> can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
    layout: layouts/layout-post
          ^

`YAMLException` was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post
              ^
        at generateError (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
        at throwError (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
        at readBlockMapping (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1073:9)
        at composeNode (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)
        at readDocument (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1525:3)
        at loadDocuments (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5)
        at load (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19)
        at Object.safeLoad (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10)
        at module.exports (/Users/davidmead/eleventy-sample/node_modules/gray-matter/lib/parse.js:12:17)
        at parseMatter (/Users/davidmead/eleventy-sample/node_modules/gray-matter/index.js:109:17)
Wrote 0 files in 0.04 seconds (v0.12.1)
Watching…
[Browsersync] Reloading Browsers...
File added: test123.md
Problem writing Eleventy templates: (more in DEBUG output)
> can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
    layout: layouts/layout-post
          ^

`YAMLException` was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post
              ^
        at generateError (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
        at throwError (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
        at readBlockMapping (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1073:9)
        at composeNode (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)
        at readDocument (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1525:3)
        at loadDocuments (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5)
        at load (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19)
        at Object.safeLoad (/Users/davidmead/eleventy-sample/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10)
        at module.exports (/Users/davidmead/eleventy-sample/node_modules/gray-matter/lib/parse.js:12:17)
        at parseMatter (/Users/davidmead/eleventy-sample/node_modules/gray-matter/index.js:109:17)
Wrote 0 files in 0.06 seconds (v0.12.1)
Watching…
[Browsersync] Reloading Browsers...
pdehaan commented 3 years ago

Sorry, there are a lot of moving parts to this at the moment...

I think part of the problem is step 5.5. In step 5, you add @11ty/eleventy@0.9 as a dependency, and then in step 6 you add @11ty/eleventy (which will install latest stable, aka v0.12.1) as a devDependency. So that's why you're seeing version 0.12.1 in the logs (and never v0.9.0).

npm WARN saveError ENOENT: no such file or directory, open '/Users/davidmead/eleventy-sample/package.json' npm WARN enoent ENOENT: no such file or directory, open '/Users/davidmead/eleventy-sample/package.json'

These warnings are also curious, but I usually run npm init -y to generate a default package.json file, so maybe thats why I don't see those warnings. But they are also warnings, so maybe we can safely ignore them.

Next, we ran npx @11ty/eleventy and got the following output:

Wrote 0 files in 0.01 seconds (v0.12.1)

Which makes total sense if this is an empty project with no templates. No input files, no output files.

Same w/ npx @11ty/eleventy --serve # Wrote 0 files in 0.39 seconds (v0.12.1), we're now running the local web server to serve the dev site, but there are no input or output files so nothing is written.


At this point we start running into errors...

File added: test123.md.html
Problem writing Eleventy templates: (more in DEBUG output)
> can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
    layout: layouts/layout-post
          ^

`YAMLException` was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post
              ^

I don't know the contents of "test123.md.html", but the fact it's using a "layout: layouts/layout-post" strikes me as odd because we haven't added any layout files or anything that I've seen yet. So my guess is that it's the TextExpander snippet. For the time being, I'd ignore TextExpander, since I'm starting to assume that might be the problem. Maybe it's adding extra characters, or tabs or some hidden control characters, or maybe its doing a Windows-esque CRLF instead of a macOS line feed.

So instead of TextExpander, just do a simple file like this:

---
title: Hello world
---

<h1>{{ title }}</h1>

That should render without issues using LiquidJS or Nunjucks.


Failing all that, try cloning my silly repo at https://github.com/pdehaan/hello-11ty and running something like the following from the project directory:

npm install
npm run build

It's the same "hello world" style repo as the snippet above, but at least it will tell you if a simple Eleventy project works on your machine, or if maybe there is something else wrong.

pdehaan commented 3 years ago

Looking at your log output again, here is the list of steps and the truncated results...

+ mkdir eleventy-sample # SUCCESS
+ cd eleventy-sample # SUCCESS

# Install Eleventy v0.9.0 as dependency...
+ npm i @11ty/eleventy@0.9 # SUCCESS

# Install Eleventy v0.12.1 as devDependency...
+ npm install --save-dev @11ty/eleventy # SUCCESS

# Run Eleventy...
+ npx @11ty/eleventy # SUCCESS
Wrote 0 files in 0.01 seconds (v0.12.1)

# Run Eleventy and start local dev server...
+ npx @11ty/eleventy --serve # SUCCESS
Wrote 0 files in 0.39 seconds (v0.12.1)

# Add a template... # ERROR
- File added: test123.md.html 
Problem writing Eleventy templates: (more in DEBUG output)
  can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
    layout: layouts/layout-post
          ^

`YAMLException` was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post
              ^
Wrote 0 files in 0.04 seconds (v0.12.1)

# Add another template... # ERROR
- File added: test123.md
Problem writing Eleventy templates: (more in DEBUG output)
  can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
    layout: layouts/layout-post
          ^

`YAMLException` was thrown:
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 12, column 7:
        layout: layouts/layout-post
              ^
Wrote 0 files in 0.06 seconds (v0.12.1)

You can see that each of the commands succeeded (including building the site and building+serving using Eleventy v0.12.1), and the build only started failing once you added the "test123.md.html" and "test123.md" templates [presumably from the TextExpander snippet, given the layout: layouts/layout-post value].

davidmead commented 3 years ago

Thanks for the help Peter.

I deleted the old folder and started fresh.

  1. mkdir eleventy-sample
  2. cd eleventy-sample
  3. npm init -y
  4. npm install --save-dev @11ty/eleventy and got a couple of warnings, but it didn't error
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)

> ejs@2.7.4 postinstall /Users/davidmead/eleventy-sample/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN eleventy-sample@1.0.0 No description
npm WARN eleventy-sample@1.0.0 No repository field.

+ @11ty/eleventy@0.12.1
added 361 packages from 319 contributors and audited 361 packages in 12.809s

17 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
  1. npx @11ty/eleventy --serve
  2. created a file, using your example, as test.md and it served it up locally just fine (see screenshot). I hand-typed the contents of that file.
Screen Shot 2021-03-25 at 12 49 56 PM
davidmead commented 3 years ago

What files in my repo should I move into this folder as a next step?

pdehaan commented 3 years ago

What files in my repo should I move into this folder as a next step?

SUCCESS! OK, so I think we've proven that Eleventy v0.12.1 works on your machine.

I think reasonable first steps are:

  1. Clone your https://github.com/davidmead/eleventy-sample repo to a new folder on your laptop somewhere.
  2. cd eleventy-sample
  3. rm -rf node_modules package-lock.json Deletes your old dependencies. In my opinion, node_modules shouldn't be checked into Git anyways since they go stale often, and makes cloning take too long. Same with the generated _site folder. I generally add both those directories to a .gitignore file.
  4. npm install Reinstall fresh dependencies from package.json and resolve everything to the latest versions that match package.json version ranges. This SHOULD install Eleventy v0.9.0, if I remember your package.json correctly.
  5. npx @11ty/eleventy Build the site locally. This should verify that Eleventy@0.9 can build the current site correctly.
  6. npm i @11ty/eleventy@latest -S Update Eleventy to latest stable release. v0.9 is old, and newer is better.
  7. npx @11ty/eleventy Rebuild the site using Eleventy v0.12.1 and verify it builds without errors.
  8. Add a new template in your /posts/ directory, but DON'T use your TextExpander snippet. Just do it manually, or copy/paste another post and modify the dates/permalink/whatever.
  9. npx @11ty/eleventy Rebuild the site and verify it builds successfully still.

After doing steps 1-9, I think it's safe to say Eleventy is working as expected. If you want to try building a new template now from your TextExpander snippet go ahead. If the build starts failing, I blame TextExpander and whatever whitespace issues or control characters it might be injecting into your files.

davidmead commented 3 years ago

Yea! That worked.

I copied the last successful post from the repo, changed it to todays date, and it published locally no issues.

Screen Shot 2021-03-25 at 8 14 10 PM

Thank you very much for being patient and troubleshooting this with me.

I also tried using the TextExpander snippet and it failed with the original YAML error. I replaced the snippet in TextExpander by re-typing and it worked fine after that :-)

Thank you again Peter

pdehaan commented 3 years ago

I find the TextExpander part fascinating... Was your previous laptop a Mac or PC? (assuming you're using TextExpander snippets from a previous computer and not created new on this computer). I think it definitely points to something specifically with the old TextExpander snippet in question.

But glad you got it sorted. Feel free to close the issue.

davidmead commented 3 years ago

Previous laptop was a 2013 MacBook Pro. It had the old version of TextExpander on it. I just copied & pasted from that to the new online version I paid for when I got the new MacBook Air. Thought it'd be easier ;-) LOL

Thanks again.