Polymer / tools

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

Some element import paths breaks build command #2234

Closed ergo closed 5 years ago

ergo commented 8 years ago

Description

Using latest release I end up with build errors if I import some elements like iron-ajax or paper-tooltip.

Versions & Environment

No errors are thrown

Actual Results

ergo@ergo-virtual-machine:~/fdgdgdssdg$ polymer build
info:    Building application...
info:    Generating build/unbundled...
info:    Generating build/bundled...
error:   Promise rejection: Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
error:   Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
    at Object.urlFromPath (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/path-transformers.js:41:15)
    at StreamAnalyzer.getFile (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:107:39)
    at StreamResolver.accept (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:210:34)
    at FileLoader.request (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/loader/file-loader.js:64:27)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:318:26)
    at Array.map (native)
    at Object.inlineScripts (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:311:34)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:458:21)
    at run (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:87:22)
    at /home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:100:28
error:   Promise rejection: Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
error:   Error: file path is not in root: /bower_components/promise-polyfill/Promise.js (/home/ergo/fdgdgdssdg)
    at Object.urlFromPath (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/path-transformers.js:41:15)
    at StreamAnalyzer.getFile (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:107:39)
    at StreamResolver.accept (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:210:34)
    at FileLoader.request (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/loader/file-loader.js:64:27)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:318:26)
    at Array.map (native)
    at Object.inlineScripts (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:311:34)
    at Object.<anonymous> (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/vulcanize/lib/vulcan.js:458:21)
    at run (/home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:87:22)
    at /home/ergo/BinProgs/node/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:100:28

Same code builds fine for me using 0.13.0

43081j commented 8 years ago

Useful debug output:

accept: /bower_components/polymer/polymer.html
accept: /bower_components/iron-ajax/iron-ajax.html
accept: /bower_components/polymer/polymer-mini.html
accept: /bower_components/iron-ajax/iron-request.html
accept: /bower_components/polymer/polymer-micro.html
accept: /bower_components/promise-polyfill/promise-polyfill-lite.html
accept: /bower_components/promise-polyfill/Promise.js
accept: ../../../../bower_components/promise-polyfill/Promise.js

Clearly this last one, wherever it is coming from, is the problem.

FredKSchott commented 8 years ago

@43081j thanks for posting that! @ergo We've actually seen that before, if you search the github issues for some snippet of that path you might find some help.

At this point this has to be coming from our analyzer, hydrolysis. If you go into /bower_components/promise-polyfill/promise-polyfill-lite.html and comment out the line where it loads ./Promise.js you should see everything build successfully. But when that line is there in any form (Promise.js, ./Promise.js, ../promise-polyfill/Promise.js) we see this added into the output:

accept: /bower_components/promise-polyfill/Promise.js
accept: ../../../../bower_components/promise-polyfill/Promise.js

So it looks like it detects Promise.js successfully, but then also detects a second, bad path immediately after.

FredKSchott commented 8 years ago

We're in the middle of some major refactoring work on the analyzer now, so I'm hopeful we can get this fixed soon. But unfortunately I don't see a simple fix inside of our build logic.

ergo commented 8 years ago

@FredKSchott wouldn't that mean that current 0.14.0 will not work for anyone to build any component that uses iron-ajax?

I'm a bit confused right now about how serious is this issue.

You mentioned:

But unfortunately I don't see a simple fix inside of our build logic.

But wouldn't that mean that most components will not build at all with 0.14.0?

jay8t6 commented 8 years ago

+1 - I know you guys are working on it, hopefully it gets fixed soon.

FredKSchott commented 8 years ago

thanks @jay8t6! šŸ˜„

@ergo I don't actually know, for example the shop template uses iron-ajax internally but it builds just fine. I've tried tracking it down this morning but haven't been able to find a cause outside of the analyzer, so I'm going to focus my work there in hopes that that fixes this for you.

ergo commented 8 years ago

@FredKSchott Actually it seems I was wrong 0.13.0 also fails - but does that silently - no error output is present.

I've prepared a minimal test case for you here: https://github.com/ergo/polymer-build-test Does that help?

43081j commented 8 years ago

@FredKSchott i had a look at this earlier.

hydrolysis inlines any script tags it finds (as long as they are outside any templates), here.

vulcanize also inlines the exact same script tags after having hydrolysis analyze it, here.

This vulcanize one is the one which fails because ../wherever does not begin with the root.

Maybe this helps point you in the right direction. Could be a difference in how they each resolve paths or something :)

JGSolutions commented 8 years ago

Not sure if this is the same issue but when i do polymer build or polymer serve i get these errors:

error: Uncaught exception: TypeError: Cannot read property 'catch' of undefined error: TypeError: Cannot read property 'catch' of undefined at /usr/local/lib/node_modules/polymer-cli/bin/polymer.js:32:12 at /usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:44:21 at ondir (/usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:187:31) at /usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:153:39 at onex (/usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:93:22) at /usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:24:18 at FSReqWrap.oncomplete (fs.js:82:15)

@FredKSchott similar issues as @ergo ?

JGSolutions commented 8 years ago

actually in the gitlab CI i get this error:

{ err: { message: 'SyntaxError: Unexpected token: punc ())', filename: 0, line: 54, col: 77, pos: 1151, stack: 'Error\n at new JS_Parse_Error (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1545:18)\n at js_error (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1553:11)\n at croak (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2092:9)\n at token_error (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2100:9)\n at unexpected (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2106:9)\n at expr_atom (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2621:13)\n at maybe_unary (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2795:19)\n at expr_ops (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2830:24)\n at maybe_conditional (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2835:20)\n at maybe_assign (eval at <anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2859:20)' } }

ergo commented 8 years ago

@FredKSchott If this helps a bit I've found something interesting, (in my test example).

if i change:

<link rel="import" href="/src/build-test-app/build-test-app.html">

to:

<link rel="import" href="src/build-test-app/build-test-app.html">

Making it a relative path the build command finishes successfully and iron-ajax is inline in the resulting file.

jay8t6 commented 8 years ago

I see that a new version is out... has the fix been included in it?

FredKSchott commented 8 years ago

@jay8t6 you could try but I don't think so, the new release was mostly init / starter-kit focused. @JGSolutions oof, that's a different kind of error. Can you open up a new issue with reproduction steps so that we can work on a fix? @ergo where do you make that change? That's great to hear that it worked, but if you made it in index.html then that will break your app if it is served from any URL that isn't the site root.

If anyone affected is willing to dig into the code base to fix this issue, I'm sure it would be greatly appreciated by everyone! I don't have the resources to dig further into this issue until the new analyzer is complete, but I'd be happy to answer questions and help guide anyone who can tackle it themselves.

JGSolutions commented 8 years ago

@FredKSchott I will open up an issue for the first error I posted. But for the second error which I was getting on the gitlab CI build process it was an issue with my code using ES6 syntax which is fine now.

garcianavalon commented 8 years ago

+1 this issue broke my build process after updating polymer cli šŸ’ƒ

FredKSchott commented 8 years ago

/cc @usergenic @garlicnation

gsf commented 8 years ago

Adding a polymer.json to my project fixed this issue for me.

jay8t6 commented 8 years ago

Same here. Polymer.json fixes the issue.

pomber commented 8 years ago

If it helps, I'm having the same issue when adding <link rel="import" href="../../bower_components/app-storage/app-localstorage/app-localstorage-document.html"> after creating an app with polymer init.

FredKSchott commented 8 years ago

polymer-build is currently being moved over to the new analyzer (see https://github.com/Polymer/polymer-build/pull/54). Once that has landed we can update the CLI and fix this for everyone once and for all (famous last words :).

Hang tight...

liuyao61 commented 7 years ago

@FredKSchott Having the same issue. Looking forward to the fix. Thank you!

ergo commented 7 years ago

@FredKSchott any news on this? polymer-cli build tool is completly broken because of this, I'm not quite sure how people work around the issue. Using gulp/grunt for building?

FredKSchott commented 7 years ago

@ergo I actually can't reproduce your bug anymore, I think this was fixed in the new analyzer/build that we merged into master a few weeks ago.

We've actually already pushed that to the cli's next branch, you should be able to try it out using npm install -g polymer-cli@next. Let me know if you can still reproduce on the next branch

ergo commented 7 years ago

@FredKSchott This is now fixed for me with polymer-cli@next - thank you!

Hunsin commented 7 years ago

Hi @ergo what version of CLI do you use? I'm using 0.18.0-alpha.6 now and still face the same problem...

And I fixed it with adding polymer.json file.

ruwentos commented 7 years ago

@Hunsin I have the same problem using 0.17.0 Would you please explain what exactly you did in the polymer.json.

greetings

S.

Hunsin commented 7 years ago

Hi @ruwentos please refer the document. The structure of polymer.json looks like this:

{
  "entrypoint": "index.html",
  "shell": "src/app/app.html",
  "fragments": [
    // files that async loaded.
  ],
  "sources": [
    "src/**/*",
    "assets/**/*",
    "bower.json"
  ],
  "extraDependencies": [
    "bower_components/webcomponentsjs/webcomponents-lite.js"
  ]
}
cordovapolymer commented 7 years ago

bump! Incorrect path in "fragments" still breaks build.

justinfagnani commented 7 years ago

@cordovapolymer is this still happening with 0.18.0-pre.13?

sammymhowe commented 7 years ago

Any updates on this? Mine still breaks for all my import paths.

jay8t6 commented 7 years ago

@sammymhowe do you have the repo on github? or can you post some code?

sammymhowe commented 7 years ago

I'm pretty new to all of this, but I have my '/src' directory with 'ps-app.html' and 'ps-pl.html'. My 'ps-app.html' is the main file that has several import statements. If I take all those imports out, the build succeeds. But once I put them in, it breaks. Here's the terminal errors:

$ polymer build
info:    Clearing build/ directory...
info:    (default) Building...

<link rel="import" href="../bower_components/polymer/polymer-element.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(10,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/app-layout/app-layout.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(11,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-selector/iron-selector.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(12,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-scroll-target-behavior/iron-scroll-target-behavior.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(13,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(14,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(15,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(17,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(18,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-item/paper-item.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(19,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(21,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/device-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(22,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/editor-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(23,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/social-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(24,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/image-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(25,24) error [could-not-load] - Unable to load import:
error:   Promise rejection: Error: 14 error(s) occurred during build.
error:   Error: 14 error(s) occurred during build.
    at BuildAnalyzer._done (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:265:36)
    at BuildAnalyzer.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:225:26)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:17:58)
    at <anonymous>
stramel commented 7 years ago

@sammymhowe That is the polymer linter that is throwing the errors. Have you bower installed those dependencies?

sammymhowe commented 7 years ago

Yes, all of these I bower installed using, for example, bower install --save PolymerElements/iron-image

stramel commented 7 years ago

@sammymhowe

What version of polymer-cli are you using? (Use polymer --version to find out) Can you provide your folder structure?

sammymhowe commented 7 years ago

My polymer-cli version is 1.3.1. This is my folder structure:

ps
- bower_components/
- build/
- src/
- - ps-app.html
- - ps-pl.html
- - shared-styles.html
- test/
- bower.json
- index.html
- manifest.json
- polymer.json
- README.md
- service-worker.js
- sw-precache-config.js

I'm new to all of this and initially used the Polymer starter kit app, then tried to rebuild the app from a fresh polymer init and then choosing application instead of starter kit. The functionality is all there, just I can't get polymer build to work.

stramel commented 7 years ago

@sammymhowe That all looks correct. Can you post your bower.json and the imports section of your ps-app.html? Also might be better to take this to slack instead.

sammymhowe commented 7 years ago
bower.json
{
  "name": "ps",
  "description": "Ps application",
  "main": "index.html",
  "dependencies": {
    "polymer": "Polymer/polymer#^2.0.0",
    "iron-icons": "PolymerElements/iron-icons#^2.0.1",
    "app-layout": "PolymerElements/app-layout#^2.0.1",
    "paper-item": "PolymerElements/paper-item#^2.0.0",
    "paper-listbox": "PolymerElements/paper-listbox#^2.0.0",
    "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^2.0.0",
    "paper-icon-button": "PolymerElements/paper-icon-button#^2.0.0",
    "iron-ajax": "PolymerElements/iron-ajax#^2.0.2",
    "iron-image": "PolymerElements/iron-image#^2.1.2",
    "google-map": "GoogleWebComponents/google-map#^1.2.0"
  },
  "devDependencies": {
    "web-component-tester": "Polymer/web-component-tester#^6.0.0",
    "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0"
  }
}
ps-app.html
<link rel="import" href="../bower_components/polymer/polymer-element.html">
<link rel="import" href="../bower_components/app-layout/app-layout.html">
<link rel="import" href="../bower_components/iron-selector/iron-selector.html">
<link rel="import" href="../bower_components/iron-scroll-target-behavior/iron-scroll-target-behavior.html">
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">

<link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">

<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../bower_components/iron-icons/device-icons.html">
<link rel="import" href="../bower_components/iron-icons/editor-icons.html">
<link rel="import" href="../bower_components/iron-icons/social-icons.html">
<link rel="import" href="../bower_components/iron-icons/image-icons.html">

The dependencies of each component confuse me. When I install something, sometimes a little thing pops up that asks me to pick a number and choose a version, and I'm never positive which one I should choose. So I'm wondering if that is what's messing things up? The versions/dependencies?

stramel commented 7 years ago

@sammymhowe That looks correct to me.

sammymhowe commented 7 years ago
polymer.json
{
  "entrypoint": "index.html",
  "shell": "src/ps-app.html",
  "fragments": [
    "src/ps-pl.html"
  ],
  "sources": [
    "src/**/*",
    "images/**/*",
    "bower.json"
  ],
  "extraDependencies": [
    "manifest.json",
    "bower_components/webcomponentsjs/*.js"
  ],
  "lint": {
    "rules": ["polymer-2"]
  }
}

The normal application folder structure had ps-app nested inside src/app/ but I took it out and just put the files under src/. Not sure if that would cause this issue. I changed the sources section of the polymer.json file to take away that nested folder in src/ but that didn't change anything.

stramel commented 7 years ago

@sammymhowe I don't think this is an issue but you may want to add a builds property in there.

  "builds": [
    { "preset": "es5-bundled" },
    { "preset": "es6-bundled" },
    { "preset": "es6-unbundled" }
  ]

Then just checking:

did you run rm -rf bower_components && bower cache clean && bower install && polymer build

sammymhowe commented 7 years ago

Running that now. It asks me these questions:

Unable to find a suitable version for webcomponentsjs, please choose one by typing one of the numbers below:
    1) webcomponentsjs#^0.7.24 which resolved to 0.7.24 and is required by polymer#1.9.3
    2) webcomponentsjs#^1.0.0 which resolved to 1.0.3 and is required by ps
    3) webcomponentsjs#^v1.0.2 which resolved to 1.0.3 and is required by polymer#2.0.2

Prefix the choice with ! to persist it to bower.json

And I'm never confident in what I choose. For this example, I chose option 3, but didn't prefix the choice with ! to persist it to bower.json.

Another example:

Unable to find a suitable version for polymer, please choose one by typing one of the numbers below:
    1) polymer#1.9 - 2 which resolved to 1.9.3 and is required by app-layout#2.0.1, iron-a11y-announcer#2.0.0, iron-a11y-keys-behavior#2.0.1, iron-ajax#2.0.2, iron-autogrow-textarea#2.1.0, iron-behaviors#2.0.0, iron-checked-element-behavior#2.0.0, iron-dropdown#2.0.0, iron-fit-behavior#2.0.1, iron-flex-layout#2.0.0, iron-form-element-behavior#2.0.0, iron-icon#2.0.1, iron-icons#2.0.1, iron-iconset-svg#2.0.1, iron-image#2.1.2, iron-input#2.0.0, iron-media-query#2.0.0, iron-menu-behavior#2.0.0, iron-meta#2.0.2, iron-overlay-behavior#2.0.0, iron-scroll-target-behavior#2.0.0, iron-selector#2.0.0, iron-validatable-behavior#2.0.0, neon-animation#2.0.1, paper-behaviors#2.0.0, paper-dropdown-menu#2.0.0, paper-icon-button#2.0.0, paper-input#2.0.1, paper-item#2.0.0, paper-listbox#2.0.0, paper-menu-button#2.0.0, paper-ripple#2.0.1, paper-styles#2.0.0
    2) polymer#^1.7.1 which resolved to 1.9.3 and is required by google-map#1.2.0
    3) polymer#^1.1.0 which resolved to 1.9.3 and is required by iron-resizable-behavior#1.0.6
    4) polymer#^1.0.0 which resolved to 1.9.3 and is required by google-apis#1.1.7
    5) polymer#^1.2.0 which resolved to 1.9.3 and is required by iron-selector#1.5.3
    6) polymer#^1.5.0 which resolved to 1.9.3 and is required by iron-jsonp-library#1.0.5
    7) polymer#^2.0.0 which resolved to 2.0.2 and is required by ps

Prefix the choice with ! to persist it to bower.json

I chose 7 for this one.

Am I doing this right?

After all of that (running the exact command you posted), I still get the same errors with the imports that I originally posted. ):

stramel commented 7 years ago

You will want to add resolutions to your bower.json

"resolutions": {
  "polymer": "^2.0.0",
  "webcomponentsjs": "^1.0.0"
}

But it looks like google-map is not hybrid so it won't be able to run in 2.0. try removing that dependency and re-running that command. You will also need to remove the link tag referencing that file.

Also, a few notes on your imports and bower.json:

sammymhowe commented 7 years ago

I removed the google-map dependency and added the resolutions, and then reran that command, and I'm still getting the same error. It's ONLY erroring on the imports in ps-app.html, but not ps-pl.html. If I comment out all the import lines in ps-app.html, it builds successfully.

stramel commented 7 years ago

@sammymhowe

After those steps try the command again :grimacing:

sammymhowe commented 7 years ago

Did everything you said, ran it again, same issue. ):

info:    Clearing build/ directory...
info:    (es6-unbundled) Building...

<link rel="import" href="../bower_components/polymer/polymer-element.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(10,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/app-layout/app-layout.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(11,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(12,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-selector/iron-selector.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(13,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-scroll-target-behavior/iron-scroll-target-behavior.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(14,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(15,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(16,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(17,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(18,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/paper-item/paper-item.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(19,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/device-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(20,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/editor-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(21,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/social-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(22,24) error [could-not-load] - Unable to load import:

<link rel="import" href="../bower_components/iron-icons/image-icons.html">
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(23,24) error [could-not-load] - Unable to load import:

<link rel="import" href="ps-pl.html">
                        ~~~~~~~~~~~~~~~~~~~~

src/ps-app.html(24,24) error [could-not-load] - Unable to load import:
error:   Promise rejection: Error: 15 error(s) occurred during build.
error:   Error: 15 error(s) occurred during build.
    at BuildAnalyzer._done (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:265:36)
    at BuildAnalyzer.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:225:26)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:17:58)
    at <anonymous>
stramel commented 7 years ago

@sammymhowe Can you post your index.html file? all those links look correct to me and if your bower install isn't failing then the dependencies should all be there. But it seems odd to me that your ps-pl.html is being flagged.

sammymhowe commented 7 years ago

I copied over the index.html file directly from Polymer Starter Kit app we had prior into this fresh new application. polymer build was having the same exact issues on the Starter Kit app, and our app was pretty messy, which is why we thought starting fresh and just bringing over the meat of the app would work. We got the app up and running easily, but yeah the polymer build command still errors on the exact same things.

index.html
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="generator" content="Polymer Starter Kit">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">

    <title>My App</title>
    <meta name="description" content="My App description">

    <!--
      If deploying to a non-root path, replace href="/" with the full path to the project root.
      For example: href="/polymer-starter-kit/relative-path-example/"
    -->
    <base href="/">

    <!-- See https://goo.gl/OOhYW5 -->
    <link rel="manifest" href="manifest.json">

    <!-- See https://goo.gl/qRE0vM -->
    <meta name="theme-color" content="#3f51b5">

    <!-- Add to homescreen for Chrome on Android. Fallback for manifest.json -->
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="application-name" content="PS App">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="apple-mobile-web-app-title" content="PS App">

    <!-- Homescreen icons -->
    <link rel="apple-touch-icon" href="images/manifest/icon-48x48.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/manifest/icon-72x72.png">
    <link rel="apple-touch-icon" sizes="96x96" href="images/manifest/icon-96x96.png">
    <link rel="apple-touch-icon" sizes="144x144" href="images/manifest/icon-144x144.png">
    <link rel="apple-touch-icon" sizes="192x192" href="images/manifest/icon-192x192.png">

    <!-- Tile icon for Windows 8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="images/manifest/icon-144x144.png">
    <meta name="msapplication-TileColor" content="#3f51b5">
    <meta name="msapplication-tap-highlight" content="no">

    <script>
      // Register the base URL
      const baseUrl = document.querySelector('base').href;

      // Load and register pre-caching Service Worker
      if ('serviceWorker' in navigator) {
        window.addEventListener('load', function() {
          navigator.serviceWorker.register(baseUrl + 'service-worker.js');
        });
      }
    </script>

    <!-- Load webcomponents-loader.js to check and load any polyfills your browser needs -->
    <script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>

    <!-- Load your application shell -->
    <link rel="import" href="src/ps-app.html">

    <!-- Add any global styles for body, document, etc. -->
    <style>
      body {
        margin: 0;
        font-family: 'Roboto', 'Noto', sans-serif;
        min-height: 100vh;
        background-color: white;
        -webkit-overflow-scrolling: auto;
      }
    </style>
  </head>
  <body>
    <ps-app></ps-app>
    <noscript>
      Please enable JavaScript to view this website.
    </noscript>
    <!-- Built with love using Polymer Starter Kit -->
  </body>
</html>
stramel commented 7 years ago

Didn't notice anything in there either. I am not having any issue with the standard polymer-starter-kit build either. I'm a bit at a loss right now without being able to locally test it. We can continue this further on the polymer Slack channel so we aren't going to spam everyone in this thread anymore :sweat_smile:

I'm on there as stramel feel free to reach out on there if you would like more help.

To everyone else, sorry for the spam :grimacing:

yveslange commented 7 years ago

@stramel did you resolve the issue ? I'm having the same problem under windows.