Frankly, I'm not sure how to reproduce this error. What I know is that somewhere in the build, I get the following message:
debug: accept: ../../../../../../bower_components/google-signin/google-signin.css
error: Promise rejection: Error: file path is not in root: /bower_components/google-signin/google-signin.css (/path/to/project/root)
error: Error: file path is not in root: /bower_components/google-signin/google-signin.css (/path/to/project/root)
at Object.urlFromPath (/usr/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/path-transformers.js:41:15)
at StreamAnalyzer.getFile (/usr/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:107:39)
at StreamResolver.accept (/usr/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:210:34)
at FileLoader.request (/usr/lib/node_modules/polymer-cli/node_modules/hydrolysis/lib/loader/file-loader.js:64:27)
at Vulcan.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/vulcanize/lib/vulcan.js:377:26)
at Array.map (native)
at Vulcan.inlineCss (/usr/lib/node_modules/polymer-cli/node_modules/vulcanize/lib/vulcan.js:365:33)
at Vulcan.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/vulcanize/lib/vulcan.js:486:21)
The number of ../
s corresponds to the depth of my project root, i.e., the absolute path it is searching for is /bower_components/google-signin/google-signin.css
. If I move the project to a different directory at a different depth, it changes accordingly.
The error depends solely on this line in my custom element for the main app container (i.e., exactly one instance of it lives in the index.html
file and it is a direct child of <body>
):
<link rel="import" href="../../bower_components/google-signin/google-signin.html">
I've commented out all uses of <google-signin>
, but the error still exists. I've put it in every position within the imports section of my code. If I comment out that line, the build succeeds.
I created a new project using the starter kit and added a <google-signin>
element to it. Building that project passed. I copied the bower_components
folder from that project into my own. The build still failed.
Searching for solutions, I found this answer on stackoverflow and tried it to no avail.
I've used nodejs
and bower
from both npm
as well as my operating system's package manager.
I should also note that the application is fully functional within the development server, e.g., polymer serve --open
.
I've posted my bower
dependencies below. My system is running Arch Linux and the last full system update was yesterday. The build was not working before the update, either.
{
"name": "PROJECT_NAME",
"description": "Web Front-end for PROJECT_NAME",
"main": "index.html",
"dependencies": {
"iron-elements": "PolymerElements/iron-elements#^1.0.10",
"paper-elements": "PolymerElements/paper-elements#^1.0.7",
"app-elements": "PolymerElements/app-elements#^0.10.1",
"google-signin": "GoogleWebComponents/google-signin#^1.3.7"
},
"devDependencies": {}
}
Further, here is a complete list of imports used by the file:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/font-roboto/roboto.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/google-signin/google-signin.html">
<link rel="import" href="../../bower_components/app-layout/app-drawer-layout/app-drawer-layout.html">
<link rel="import" href="../../bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
My polymer.json
file did not contain all of the necessary fragments
, and this was causing the error.