nhoizey / pack11ty

An heavily opinionated Eleventy template project with Sass
https://pack11ty.dev/
MIT License
199 stars 11 forks source link

Eleventy:EleventyErrorHandler Problem writing Eleventy templates: +0ms #3

Closed theapplegates closed 4 years ago

theapplegates commented 4 years ago

I get an error when I try to run your template. I am not a developer but I managed to find a Debug command in the package.json.

Here is the error section: Eleventy:EleventyErrorHandler Problem writing Eleventy templates: +0ms Eleventy:EleventyErrorHandler data.page.inputPath.match is not a function Eleventy:EleventyErrorHandler Eleventy:EleventyErrorHandler TypeError was thrown: +1ms Eleventy:EleventyErrorHandler (error stack): TypeError: data.page.inputPath.match is not a function Eleventy:EleventyErrorHandler at type (/Users/thor2/Documents/test2-pack11ty/src/src.11tydata.js:6:37) Eleventy:EleventyErrorHandler at layout (/Users/thor2/Documents/test2-pack11ty/src/src.11tydata.js:21:23) Eleventy:EleventyErrorHandler at ComputedDataProxy.findVarsUsed (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/ComputedDataProxy.js:53:11) Eleventy:EleventyErrorHandler at ComputedData.getVarOrder (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/ComputedData.js:55:34) Eleventy:EleventyErrorHandler at processTicksAndRejections (internal/process/task_queues.js:97:5) Eleventy:EleventyErrorHandler at async ComputedData.setupData (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/ComputedData.js:73:17) Eleventy:EleventyErrorHandler at async Template.augmentFinalData (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/Template.js:422:5) Eleventy:EleventyErrorHandler at async Template.getTemplates (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/Template.js:438:7) Eleventy:EleventyErrorHandler at async TemplateMap.initDependencyMap (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/TemplateMap.js:246:22) Eleventy:EleventyErrorHandler at async TemplateMap.cache (/Users/thor2/Documents/test2-pack11ty/node_modules/@11ty/eleventy/src/TemplateMap.js:279:5) +0ms

Does this mean anything to you?

Thanks for your help. Paul

nhoizey commented 4 years ago

Hi Paul, could you also tell me if you created additional folders in src/?

theapplegates commented 4 years ago

I did not but can do so now, and try to build it again.

nhoizey commented 4 years ago

So you just got the code from this repository, and tried building the site?

Or did you change anything?

theapplegates commented 4 years ago

I tried building at first and got the error. I used the template method and then a git clone. I then tried to change things. I thought a "post" in the news section would be simple enough but I still got the error. I'm afraid the error is still there. I'm not sure what is happening.

theapplegates commented 4 years ago

This might be more helpful than the debug info.

Having trouble writing template: _site/pages/github/index.html

TemplateWriterWriteError was thrown

(src/_layouts/base.njk) Template render error: (/Users/thor2/Desktop/pack11ty/src/_includes/head.njk) EleventyShortcodeError: Error with Nunjucks shortcode include_raw

Template render error was thrown

ENOENT: no such file or directory, open '_site/ui/css/undefined'

Template render error was thrown: Error: ENOENT: no such file or directory, open '_site/ui/css/undefined' at Object.openSync (fs.js:457:3) at Object.readFileSync (fs.js:359:35) at include_raw (/Users/thor2/Desktop/pack11ty/src/_11ty/shortcodes/include_raw.js:12:24) at /Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/src/BenchmarkGroup.js:28:26 at ShortcodeFunction.run (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:128:55) at eval (eval at _compile (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/node_modules/nunjucks/src/environment.js:631:18), :12:71) at Template.root [as rootRenderFunc] (eval at _compile (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/node_modules/nunjucks/src/environment.js:631:18), :16:3) at Template.render (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/node_modules/nunjucks/src/environment.js:550:10) at eval (eval at _compile (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/node_modules/nunjucks/src/environment.js:631:18), :17:10) at fn (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/@11ty/eleventy/node_modules/a-sync-waterfall/index.js:26:24) Problem writing Eleventy templates: (more in DEBUG output)

Having trouble writing template: _site/pages/github/index.html

TemplateWriterWriteError was thrown

(src/_layouts/base.njk) Template render error: (/Users/thor2/Desktop/pack11ty/src/_includes/head.njk) EleventyShortcodeError: Error with Nunjucks shortcode include_raw

Template render error was thrown

ENOENT: no such file or directory, open '_site/ui/css/undefined'

nhoizey commented 4 years ago

I still can't reproduce, but it helps more looking in the right direction, indeed, thanks.

nhoizey commented 4 years ago

Did you use one of npm commands to build the site, or directly eleventy?

You should use (I have to document this):

theapplegates commented 4 years ago

I did use just eleventy. Let me try npm run build and npm start. I'll rm-rf node_modules and .cache if it is there and start fresh. Last night I added a test droplet with DigitalOcean. A Ubuntu server ( 18.X) and a Debian(10.X) and both had the same issue, just building without adding any content of my own. I used eleventy to build those though, I did not use npm run build or npm start.

theapplegates commented 4 years ago

Here is the result of npm start

bobs:pack11ty thor2$ clear bobs:pack11ty thor2$ npm start

pack11ty@1.0.0 start /Users/thor2/Desktop/pack11ty npm-run-all --sequential clean assets:build watch

pack11ty@1.0.0 clean /Users/thor2/Desktop/pack11ty rimraf _site src/_generated

pack11ty@1.0.0 assets:build /Users/thor2/Desktop/pack11ty npm-run-all -p css:build js:build

pack11ty@1.0.0 css:build /Users/thor2/Desktop/pack11ty npm-run-all -p css:*:build

pack11ty@1.0.0 js:build /Users/thor2/Desktop/pack11ty rollup -c

src/_assets/js/critical.js → _site/ui/js...

pack11ty@1.0.0 css:critical:build /Users/thor2/Desktop/pack11ty postcss src/_assets/postcss/critical.scss -o _site/ui/css/critical.css

pack11ty@1.0.0 css:additional:build /Users/thor2/Desktop/pack11ty postcss src/_assets/postcss/additional.scss -o _site/ui/css/additional.css

(!) The "this.resolveId" plugin context function used by plugin entrypoint-hashmanifest is deprecated. The "this.resolve" plugin context function should be used instead. (!) Generated an empty chunk critical created _site/ui/js in 545ms

src/_assets/js/additional.js → _site/ui/js... (!) The "this.resolveId" plugin context function used by plugin entrypoint-hashmanifest is deprecated. The "this.resolve" plugin context function should be used instead. created _site/ui/js in 214ms

src/_assets/js/additional.js → _site/ui/js... (!) The "this.resolveId" plugin context function used by plugin entrypoint-hashmanifest is deprecated. The "this.resolve" plugin context function should be used instead. created _site/ui/js in 268ms

pack11ty@1.0.0 watch /Users/thor2/Desktop/pack11ty npm-run-all -p css:watch js:watch eleventy:watch

pack11ty@1.0.0 js:watch /Users/thor2/Desktop/pack11ty chokidar 'src/_assets/*/.js' --command 'npm run js:build'

pack11ty@1.0.0 css:watch /Users/thor2/Desktop/pack11ty chokidar 'src/_assets/*/.scss' --command 'npm run css:build'

pack11ty@1.0.0 eleventy:watch /Users/thor2/Desktop/pack11ty cross-env NODE_ENV=development eleventy --serve

Watching "src/_assets/*/.js" .. Watching "src/_assets/*/.scss" .. Problem writing Eleventy templates: (more in DEBUG output)

data.page.inputPath.match is not a function

TypeError was thrown: ^C bobs:pack11ty thor2$ npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pack11ty@1.0.0 eleventy:watch: cross-env NODE_ENV=development eleventy --serve npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pack11ty@1.0.0 eleventy:watch script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/thor2/.npm/_logs/2020-04-15T10_24_18_791Z-debug.log ^C

Here is the debug.log it mentions

bobs:pack11ty thor2$ cat /Users/thor2/.npm/_logs/2020-04-15T10_24_18_791Z-debug.log 0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli '/Users/thor2/.nvm/versions/node/v12.16.1/bin/node', 1 verbose cli '/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/bin/npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'eleventy:watch' 1 verbose cli ] 2 info using npm@6.14.4 3 info using node@v12.16.1 4 verbose run-script [ 'preeleventy:watch', 'eleventy:watch', 'posteleventy:watch' ] 5 info lifecycle pack11ty@1.0.0~preeleventy:watch: pack11ty@1.0.0 6 info lifecycle pack11ty@1.0.0~eleventy:watch: pack11ty@1.0.0 7 verbose lifecycle pack11ty@1.0.0~eleventy:watch: unsafe-perm in lifecycle true 8 verbose lifecycle pack11ty@1.0.0~eleventy:watch: PATH: /Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/thor2/Desktop/pack11ty/node_modules/.bin:/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/thor2/Desktop/pack11ty/node_modules/.bin:/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/thor2/Desktop/pack11ty/node_modules/.bin:/usr/local/opt/ruby/bin:/usr/local/opt/openssl@1.1/bin:/usr/local/opt/ruby/bin:/usr/local/opt/qt/bin:/usr/local/opt/libxml2/bin:/usr/local/opt/mozjpeg/bin:/Users/thor2/Library/Python/2.7/bin:/usr/local/sbin:/Users/thor2/.nvm/versions/node/v12.16.1/bin:/Users/thor2/.rvm/gems/ruby-2.5.0/bin:/Users/thor2/.rvm/gems/ruby-2.5.0@global/bin:/Users/thor2/.rvm/rubies/ruby-2.5.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/aria2/bin:/Users/thor2/.rvm/bin:/Users/thor2/.rvm/bin 9 verbose lifecycle pack11ty@1.0.0~eleventy:watch: CWD: /Users/thor2/Desktop/pack11ty 10 silly lifecycle pack11ty@1.0.0~eleventy:watch: Args: [ '-c', 'cross-env NODE_ENV=development eleventy --serve' ] 11 silly lifecycle pack11ty@1.0.0~eleventy:watch: Returned: code: 1 signal: null 12 info lifecycle pack11ty@1.0.0~eleventy:watch: Failed to exec eleventy:watch script 13 verbose stack Error: pack11ty@1.0.0 eleventy:watch: cross-env NODE_ENV=development eleventy --serve 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:311:20) 13 verbose stack at ChildProcess. (/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:311:20) 13 verbose stack at maybeClose (internal/child_process.js:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) 14 verbose pkgid pack11ty@1.0.0 15 verbose cwd /Users/thor2/Desktop/pack11ty 16 verbose Darwin 19.4.0 17 verbose argv "/Users/thor2/.nvm/versions/node/v12.16.1/bin/node" "/Users/thor2/.nvm/versions/node/v12.16.1/lib/node_modules/npm/bin/npm-cli.js" "run" "eleventy:watch" 18 verbose node v12.16.1 19 verbose npm v6.14.4 20 error code ELIFECYCLE 21 error errno 1 22 error pack11ty@1.0.0 eleventy:watch: cross-env NODE_ENV=development eleventy --serve 22 error Exit status 1 23 error Failed at the pack11ty@1.0.0 eleventy:watch script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ] bobs:pack11ty thor2$

theapplegates commented 4 years ago

This includes a simple addition to the news section. bobs:news thor2$ ls 2020-04-09-hello.md 2020-04-14-test.md index.md

What is strange is it does output to _site like it should. I see each news post has a folder and the appropriate index.html in the folder.

Running npm start results in the same thing.

Since no one else has this issue, I propose closing it and I will just try different things on my own. I thought it might be a quick fix and I don't want to waste your resources working on something that only affects me.

theapplegates commented 4 years ago

Found this with a Google search. Does the current error "data.page.inputPath.match is not a function" have to do with this?

https://github.com/11ty/eleventy/issues/789

Ok, I'm going to close this. You know how things work, in a few days I'll try another build and it will work. Thanks for your help.

nhoizey commented 4 years ago

@theapplegates thanks for your report. Unfortunately, I still don't understand where the issue comes from.

If you still have the issue when you try again, can you run the build in debug mode?

You'll have to run npm run debug:build

Thanks!

theapplegates commented 4 years ago

Here are the logs. I saved them as github gists. Debug screen results

Log1 mentioned /Users/thor2/.npm/_logs/2020-04-15T23_25_42_340Z-debug.log

Log2 /Users/thor2/.npm/_logs/2020-04-15T23_25_42_365Z-debug.log

Log3 /Users/thor2/.npm/_logs/2020-04-15T23_25_42_383Z-debug.log

theapplegates commented 4 years ago

Oops, it seems I copied these as a .js.

Just leave the .js off each. Sorry I'm not good at this.

nhoizey commented 4 years ago

@theapplegates sorry, it looks like I was not clear. I don't need npm's logs, but Eleventy ones.

Can you run this command?

npm run debug:build

And give me the full log from your terminal?

Thanks

theapplegates commented 4 years ago

This gist has that. https://gist.github.com/theapplegates/4872b583864fb8f1ded2ce3a770b9b48

I cleared the terminal and ran that command and copied the whole screen. The gist shows the output. Is that not correct?

nhoizey commented 4 years ago

Thanks a lot, I have been able to get the same error!

Now I have to find how to fix it.

theapplegates commented 4 years ago

That's great. I'm not losing my mind. It must be a weird error because no one else has mentioned it.

nhoizey commented 4 years ago

Well, there are not many users yet… 😁

nhoizey commented 4 years ago

@theapplegates are you running macOS Catalina?

I might have found where the issue comes from. There is a recurring issue with node-gyp on Catalina, which you might have seen in logs when running npm install.

Could you check this "acid test"?

https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md#the-acid-test

theapplegates commented 4 years ago

Oh, I've spent hours trying to pass that test with other installs. Gatsby was troublesome. I failed it and nothing I did would fix it. I tried all their solutions, until I found this.

https://github.com/schnerd/d3-scale-cluster/issues/7

SK-CSE commented on Nov 9, 2019 following step help me to resolve this issue on Mac Catalina OS

sudo rm -rf $(xcode-select -print-path) xcode-select --install /usr/sbin/pkgutil --packages | grep CL sudo npm install -g node-gyp

Now node-gyp is not a problem, until now at least.

It's worth pointing out I went to digitalcoean and created two systems, 1 ubuntu 18 nd 1 Debian 10 and each got the same error, and they were not Macs of course.

theapplegates commented 4 years ago

It looks part of the solution if you can't pass the tests are some commands I listed above. I did all that and the acid test still does not pass :-(

sudo rm -rf $(xcode-select -print-path) # Enter root password. No output is normal. sudo rm -rf /Library/Developer/CommandLineTools # Enter root password. xcode-select --install If the acid test steps above still does not pass then... npm explore npm -g -- npm install node-gyp@latest npm explore npm -g -- npm explore npm-lifecycle -- npm install node-gyp@latest If the acid test still does not pass then... Add a comment to https://github.com/nodejs/node-gyp/issues/1927 so we can improve.

Do you want me to try that again? Just let me know and I can try and uninstall and reinstall Xcode Tools and reinstall node-gyp

nhoizey commented 4 years ago

If you can try again just to be sure, it would help.

It fixed the issue on my side.

theapplegates commented 4 years ago

Nice. Give me 15-20 or however long it takes. I'll do it now.

theapplegates commented 4 years ago

Now I'm confused, It did not work. sudo npm install -g node-gyp worked fine no errors, after I passed the acid test:

bobs:~ thor2$ sudo rm -rf $(xcode-select -print-path) Password: bobs:~ thor2$ sudo rm -rf /Library/Developer/CommandLineTools bobs:~ thor2$ xcode-select --install xcode-select: note: install requested for command line developer tools bobs:~ thor2$ /usr/sbin/pkgutil --packages | grep CL com.apple.pkg.CLTools_Executables com.apple.pkg.CLTools_SDK_macOS1015 com.apple.pkg.CLTools_SDK_macOS1014 com.apple.pkg.CLTools_macOS_SDK bobs:~ thor2$ /usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables package-id: com.apple.pkg.CLTools_Executables version: 11.4.1.0.1.1586360307 volume: / location: / install-time: 1587058716 groups: com.apple.FindSystemFiles.pkg-group

I wonder if I should delete everything developer related. Delete and re-install nodejs completely and re-install.

theapplegates commented 4 years ago

I am doing it again. Just to make sure I did it right.

theapplegates commented 4 years ago

Still does not work. I'm deleting the command line tools with: sudo rm -rf $(xcode-select -print-path sudo rm -rf /Library/Developer/CommandLineTools

and then I am going to install the full Xcode program not just the command line tools and trying to install node-gyp again.

theapplegates commented 4 years ago

No luck. Installed Xcode, re-installed node-gyp and got the same error.

Unfortunately I have to go. I can work on it again tonight.

theapplegates commented 4 years ago

Fixed it. Node was installed with homebrew. I removed the homebrew node install and installed with the package at their website. https://nodejs.org/en/download/ Works fine now. I feel stupid, it was so long ago I forgot I used homebrew to install it. Sorry.

nhoizey commented 4 years ago

You don't have to be sorry, this should not happen even with Homebrew, and I've struggled multiple time with node-gyp already.

Well, I'm happy you'll be able to work with Pack11ty, looking forward to see what you can do with it! 👍