自从我安装聚合物cli后,我一直面临着这个问题 . 我无法在开发过程中提供组件 . 我必须编写自己的Node.js服务器,重新映射网址以使用组件 . 但documentation page清楚地表明它已经用自己的工具完成了这项工作 .

What I did

  • 使用polymer-cli的 polymer init 创建组件

  • 使用 polymer serve 服务组件

  • 结果是意外的并导致以下错误:

聚合物版本:0.18.0-pre.15

Ubuntu 16.04.2 LTS x64

关于运行聚合物服务

info:    Files in this directory are available under the following URLs
      applications: http://127.0.0.1:8081
      reusable components: http://127.0.0.1:8081/components/test-element/

A)如果我尝试打开localhost:8081

GET http://localhost:8081/webcomponentsjs/webcomponents-loader.js 404 (Not Found)

GET http://localhost:8081/iron-component-page/iron-component-page.html 404 (Not Found)

B)如果我尝试打开`localhost:8081 / components / test-element / demo /

该网址重定向到 http://localhost:8081/home/user-name/project-root/test-element/

提供项目根目录中的索引页面 .

GET http://localhost:8081/home/user-name/project-root/webcomponentsjs/webcomponents-loader.js 

GET http://localhost:8081/home/user-name/project-root/iron-component-page/iron-component-page.html 404 (Not Found)