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

error with lit-element version "^0.5.2" Uncaught TypeError: window.ShadyCSS.prepareTemplateDom is not a function #104

Closed
ranjeet-choudhary opened this issue Jun 15, 2018 · 17 comments
Assignees

Comments

@ranjeet-choudhary
Copy link

ranjeet-choudhary commented Jun 15, 2018

Uncaught TypeError: window.ShadyCSS.prepareTemplateDom is not a function
at result (shady-render.ts:54)
at render (shady-render.ts:154)
at HTMLElement._applyRender (lit-element.ts:286)
at HTMLElement._propertiesChanged (lit-element.ts:218)
at HTMLElement._flushProperties (properties-changed.js:370)
at HTMLElement._flushProperties (lit-element.ts:232)
at HTMLElement.ready (properties-changed.js:193)
at HTMLElement.ready (lit-element.ts:119)
at HTMLElement._enableProperties (properties-changed.js:347)
at HTMLElement.connectedCallback (properties-mixin.js:226)

similar to
Polymer/pwa-starter-kit#157

@mrherndon
Copy link

I've been fighting this all morning, glad I'm not the only one.

@mrherndon
Copy link

mrherndon commented Jun 15, 2018

It seems like the fixes for this were made in lit-html, in shady-render.js, according to the commit log (I don't know how to do cool links for these but here: lit/lit@f9f8238). It doesn't seem to actually fix it though, at least, I'm still getting the same error on it.

edit: whatDaYaKnow, it makes the cool links for me. neato.

@TimvdLippe
Copy link
Contributor

I think this is fixed on master, but we havent made a release for that yet. Could you try that out?

@mrherndon
Copy link

sure, still getting used to some of this npm stuff though. Would I have to git clone it into my project, as opposed to npm updating? Or git clone it somewhere and copy the changes over temporarily?

@pshihn
Copy link

pshihn commented Jun 15, 2018

@mrherndon You can just do

npm i Polymer/lit-element

This will load the current master

@mrherndon
Copy link

Thanks.
Same error though.

shady-render.ts:54 Uncaught TypeError: window.ShadyCSS.prepareTemplateDom is not a function
    at result (shady-render.ts:54)
    at render (shady-render.ts:154)
    at HTMLElement._applyRender (lit-element.ts:286)
    at HTMLElement._propertiesChanged (lit-element.ts:218)
    at HTMLElement._flushProperties (properties-changed.js:370)
    at HTMLElement._flushProperties (lit-element.ts:232)
    at HTMLElement.ready (properties-changed.js:193)
    at HTMLElement.ready (lit-element.ts:119)
    at HTMLElement._enableProperties (properties-changed.js:347)
    at HTMLElement.connectedCallback (properties-mixin.js:226)

@TimvdLippe
Copy link
Contributor

TimvdLippe commented Jun 15, 2018 via email

@mrherndon
Copy link

mrherndon commented Jun 15, 2018

in my node_modules/@webcomponents/webcomponentsjs/package.json first line is
"_from": "@webcomponents/webcomponentsjs@2.0.2",
And in node_modules/lit-html/package.json, I have:
"_from": "lit-html@0.10.2",

@mrherndon
Copy link

On a whim(cause I had a weird problem a few months back that reminded me of this), I deleted node_modules and re-ran npm install with --unsafe-perm and it works now. Not sure what the issue really was, but I'm glad to have fixed it.
Thank you all for your help. @TimvdLippe , you're always quick to help when I need it, man!

@TimvdLippe
Copy link
Contributor

TimvdLippe commented Jun 15, 2018 via email

@ranjeet-choudhary
Copy link
Author

After npm i Polymer/lit-element
I get below error on polymer serve
Uncaught TypeError: Failed to resolve module specifier "@polymer/lit-element". Relative references must start with either "/", "./", or "../".

@mrherndon
Copy link

I ran into that when I was tinkering with it. I think both you and I updated in a weird in-between moment that left our node_modules folder somehow out of sync. Try copying your node_modules folder somewhere safe. Then delete the one in your project. Try 'npm install' and see if that fixes it.
If you're set up like I am, you may need to run it 'sudo npm install --unsafe-perm' to get it to install correctly.

@Boyak
Copy link

Boyak commented Jun 21, 2018

I run into this same problem, but any of solution above is not working. Also got problem with "Uncaught TypeError: Failed to resolve module specifier "@polymer/lit-element"." and stuck with that. One more condition from my side is that is not working only in Chrome in my case.

@davie-robertson
Copy link

davie-robertson commented Jun 30, 2018

I'm still facing this issue too.

FWIW I see that @Polymer\lit-element\package.json contains
"dependencies": { "@polymer/polymer": "^3.0.2", "lit-html": "^0.10.0" },

this is after I've tried deleting the node_modules, reinstalling them (even adding the --unsafe-perm.

Is there a simple fix that I'm missing?

EDIT: rm -rf node_modules/ package-lock.json followed by npm i sorted it out

@petecarapetyan
Copy link

I'm seeing the problem on one project, but note that my pwa-starter-kit by Meownica's team is working fine with the same lit dependencies that are failing on my mixed polymer/lit project. Guessing that it doesn't like me to be mixing lit and polymer elements on the same app, at least with these particular versions.

@sorvell
Copy link
Member

sorvell commented Aug 27, 2018

Looks like these issues have been resolved by now. LitElement uses the correct ShadyCSS version, but this can conflict if you have an older version of the webcomponentsjs polyfill installed. If you're hitting this issue, please make sure to update the webcomponentsjs polyfill to at least version 2.0.3.

@sorvell sorvell closed this as completed Aug 27, 2018
@aaron-peloquin
Copy link

aaron-peloquin commented Sep 6, 2018

I'm still getting this issue while trying to update my the /src/app-view-home.js file in my app. I am using webcomponentsjs v2.1.1

https://github.com/aaron-peloquin/tabletopdice-project

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

No branches or pull requests

10 participants