lit-element.js is not found when installed via npm

Created on 21 Aug 2018  路  3Comments  路  Source: Polymer/lit-element

When I install npm i Polymer/lit-element and import it

import {LitElement, html} from '@polymer/lit-element/lit-element.js';

and then run polymer serve

following error shows up:
http://localhost:8081/node_modules/@polymer/lit-element/lit-element.js 404 (Not Found)

I looked up in the node_modules dir and inside the lit-element folder is no lit-element.js ... its missing!

Expected Results


Import is working.

Actual Results


lit-element.js is not installed when installing with npm

Browsers Affected

  • [x] Chrome
  • [x] Firefox
  • [x] Edge
  • [x] Safari 11
  • [x] Safari 10
  • [x] IE 11

Versions

my package.json has thees dependencies listed:

"@webcomponents/webcomponentsjs": "^2.0.2",
"@polymer/polymer": "^3.0.2",
"@polymer/lit-element": "^0.5.2"

Most helpful comment

Try importing from simply: import { html, LitElement } from "@polymer/lit-element";

Also from current README: https://github.com/Polymer/lit-element#bigger-example

All 3 comments

Try importing from simply: import { html, LitElement } from "@polymer/lit-element";

Also from current README: https://github.com/Polymer/lit-element#bigger-example

Try importing from simply: import { html, LitElement } from "@polymer/lit-element";

Also from current README: https://github.com/Polymer/lit-element#bigger-example

I used the following to remove a warning I was getting in WebStorm and an error when running tests:
import { LitElement, html } from 'lit-element/lit-element.js';

@Anid4u2c you quoted a quite out-of-date import. This package has been named simply lit-element for a lone time now, and you can just import from 'lit-element', you don't need 'lit-element/lit-element.js'

Was this page helpful?
0 / 5 - 0 ratings