[英]Error building polymer project with google-signin
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, ie, the absolute path it is searching for is /bower_components/google-signin/google-signin.css
. ../
s的数量对应于我的项目根目录的深度,即它要搜索的绝对路径是/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 (ie, exactly one instance of it lives in the index.html
file and it is a direct child of <body>
): 该错误仅取决于主应用容器的我自定义元素中的这一行(即,它的一个实例恰好位于
index.html
文件中,并且是<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. 我已注释掉
<google-signin>
所有用法,但该错误仍然存在。 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. 我使用入门工具包创建了一个新项目,并向其中添加了一个
<google-signin>
元素。 Building that project passed. 建立该项目已通过。 I copied the
bower_components
folder from that project into my own. 我将那个项目的
bower_components
文件夹复制到了自己的文件夹中。 The build still failed. 构建仍然失败。
Searching for solutions, I found this answer on stackoverflow and tried it to no avail. 在寻找解决方案时,我在stackoverflow上找到了这个答案,并尝试无济于事。
I've used nodejs
and bower
from both npm
as well as my operating system's package manager. 我已经从
npm
和操作系统的软件包管理器中使用过nodejs
和bower
。
I should also note that the application is fully functional within the development server, eg, polymer serve --open
. 我还应注意,该应用程序在开发服务器中具有全部功能,例如,
polymer serve --open
。
I've posted my bower
dependencies below. 我在下面发布了我的
bower
依赖项。 My system is running Arch Linux and the last full system update was yesterday. 我的系统正在运行Arch Linux,最近的完整系统更新是昨天。 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">
我的polymer.json
文件未包含所有必需的fragments
,这导致了错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.