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

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

Closed
theapplegates opened this issue Apr 14, 2020 · 30 comments
Closed

Comments

@theapplegates
Copy link

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
Copy link
Owner

nhoizey commented Apr 14, 2020

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

@theapplegates
Copy link
Author

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

@nhoizey
Copy link
Owner

nhoizey commented Apr 14, 2020

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

Or did you change anything?

@theapplegates
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

nhoizey commented Apr 15, 2020

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

@nhoizey
Copy link
Owner

nhoizey commented Apr 15, 2020

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

You should use (I have to document this):

  • npm run build for a production build
  • npm start for a development build with live reload

@nhoizey nhoizey added feature: documentation 📑 Improvements or additions to documentation type: enhancement 🧗‍♂️ New feature or request priority: high 🟠 labels Apr 15, 2020
@nhoizey nhoizey self-assigned this Apr 15, 2020
@theapplegates
Copy link
Author

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
Copy link
Author

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.0preeleventy:watch: pack11ty@1.0.0
6 info lifecycle pack11ty@1.0.0
eleventy:watch: pack11ty@1.0.0
7 verbose lifecycle pack11ty@1.0.0eleventy: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.0eleventy: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.0eleventy: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
Copy link
Author

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
Copy link
Author

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

11ty/eleventy#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
Copy link
Owner

nhoizey commented Apr 15, 2020

@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
Copy link
Author

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

<script src="https://gist.github.com/theapplegates/4872b583864fb8f1ded2ce3a770b9b48.js"></script>

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

<script src="https://gist.github.com/theapplegates/4c80be6e9898023655c2b05816e3e7c7.js"></script>

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

<script src="https://gist.github.com/theapplegates/63d06334a52d2df0aa0f830faebecdb4.js"></script>

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

<script src="https://gist.github.com/theapplegates/56534a891393dd57b57879e1830531c0.js"></script>

@theapplegates
Copy link
Author

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

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

@nhoizey
Copy link
Owner

nhoizey commented Apr 16, 2020

@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

@nhoizey nhoizey reopened this Apr 16, 2020
@nhoizey nhoizey added type: breaking 💔 and removed feature: documentation 📑 Improvements or additions to documentation type: enhancement 🧗‍♂️ New feature or request labels Apr 16, 2020
@theapplegates
Copy link
Author

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
Copy link
Owner

nhoizey commented Apr 16, 2020

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

Now I have to find how to fix it.

@theapplegates
Copy link
Author

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

@nhoizey
Copy link
Owner

nhoizey commented Apr 16, 2020

Well, there are not many users yet… 😁

@nhoizey
Copy link
Owner

nhoizey commented Apr 16, 2020

@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
Copy link
Author

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.

schnerd/d3-scale-cluster#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
Copy link
Author

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 nodejs/node-gyp#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
Copy link
Owner

nhoizey commented Apr 16, 2020

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

It fixed the issue on my side.

@theapplegates
Copy link
Author

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

@theapplegates
Copy link
Author

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
Copy link
Author

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

@theapplegates
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

nhoizey commented Apr 17, 2020

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! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants