Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

Cannot convert Polymer 2 starter-kit example successfully #665

Closed dsyrstad closed 2 years ago

dsyrstad commented 6 years ago

I tried to convert the Polymer 2 stater-kit example to Polymer 3 and it fails to load in the browser. I'm using

polymer --version: 1.7.7 node --version: v8.11.3 npm --version: 6.3.0 bower --version: 1.8.4 Ubuntu 16.04.1

I followed these instructions to create the Polymer 2 start-kit app: https://www.polymer-project.org/2.0/start/toolbox/set-up

mkdir polymer2-3-upgrade-app
cd polymer2-3-upgrade-app
polymer init

I chose polymer-2-starter-kit

When I ran: polymer serve, it worked fine. I was up and running with Polymer 2 successfully.

Then I followed this guide: https://www.polymer-project.org/3.0/docs/upgrade to convert to Polymer 3:

modulizer --out . --npm-version 1.0.0 (Omitted --import-style name as recommended for application projects.)

[1/2] 🌀  Converting Package...
Out directory: /home/dsyrstad/IdeaProjects/polymer2-3-upgrade-app
Failed to read entrypoints of package 'shadycss' because the package does not have a 'bower.json' file.
polymer-starter-kit: Did not find an HTML main in bower.json. A main was not added to package.json, so this package will not be directly importable by name. Manually update main in your bower.json or package.json to fix.
[2/2] 🎉  Conversion Complete!

Then I ran: npm install

Which told me:

npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN polymer-starter-kit@1.0.0 No repository field.

added 65 packages from 482 contributors and audited 575 packages in 4.091s
found 4 vulnerabilities (3 low, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

It appeared the conversion basically worked, so I ran: polymer serve I opened http://127.0.0.1:8081 in Chrome. Chrome Dev console reported:

webcomponents-loader.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
polymer-element.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-drawer.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-drawer-layout.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-header.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-header-layout.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-scroll-effects.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-toolbar.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-location.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app-route.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
iron-pages.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
iron-selector.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
paper-icon-button.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
settings.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
html-tag.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
import-href.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Only index.html, my-*.js, and service-worker.js were loaded by the browser. None of the node_modules loaded, probably because of imports like this:

import { PolymerElement } from '../../@polymer/polymer/polymer-element.js';

And this line in index.html:

<script src="../@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>

Also tried:

polymer serve --npm
polymer serve --npm --module-resolution="node"
polymer serve --npm --module-resolution="none"
polymer serve --module-resolution="none"

All give the same result.

Help? I also cannot get my current Polymer 2 app to convert because of spread operators.

Note: I originally raised this issue in https://github.com/Polymer/polymer-modulizer/issues/461 not knowing that project is defunct. It would be good if someone monitored the issues there. There's another new one after mine...

MacTheZazou commented 5 years ago

This issue is more than 1 month old and blocking a lot of people. Can we have a little help regarding how to fix it?

ivegotwings commented 5 years ago

I have exact same errors-

polymer --version: 2.0 node --version: v10.11.0 npm --version: 6.4.1 bower --version: 1.8.4 OS- windows 10

Also I used to get the JAVASCRIPT HEAP OUT OF MEMORY, I used the command SET NODE_OPTIONS "--max-old-space-size=8192". Then this error stoped.

After receiving the errors mentioned above. Polymer generated around 39 files all related to coverage and tests, but no polymer file is converted. I also tried supplying a main in bower.json but it did not help either.

ivegotwings commented 5 years ago

It seems the conversion works without errors on Mac OS but fails on widows and ubuntu.

dsyrstad commented 5 years ago

It seems the conversion works without errors on Mac OS.

This issue was reported against Ubuntu.

dsyrstad commented 5 years ago

Is the modulizer even being maintained anymore? Apparently no response from the team here. I mean, it's a sad state of things if it won't even convert the Polymer 2 sample app.

MacTheZazou commented 5 years ago

I agree! We need a bug free tool to upgrade to P3 & lit-element!

MacTheZazou commented 5 years ago

Help me, Obi-Wan Kenobi. You're my only hope.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!