尝试运行Polymer Starter Kit

时间:2015-06-29 00:38:44

标签: polymer polymer-1.0

我正在尝试运行Polymer starter kit,但是当我尝试运行'gulp serve'(没有引号)时,它会在浏览器上打开页面,但它没有显示任何内容。

当我检查JS控制台时,我收到以下错误:

http://localhost:3000/bower_components/webcomponentsjs/webcomponents-lite.js无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/iron-flex-layout/classes/iron-flex-layout.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/iron-icons/iron-icons.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/iron-pages/iron-pages.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/iron-selector/iron-selector.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-drawer-panel/paper-drawer-panel.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-header-panel/paper-header-panel.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-icon-button/paper-icon-button.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-item/paper-item.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-material/paper-material.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-menu/paper-menu.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-styles/paper-styles-classes.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-toast/paper-toast.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/paper-toolbar/paper-toolbar.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/platinum-sw/platinum-sw-cache.html无法加载资源:服务器响应状态为404(未找到) http://localhost:3000/bower_components/platinum-sw/platinum-sw-register.html无法加载资源:服务器响应状态为404(未找到) my-greeting.html:32未捕获的ReferenceError:未定义聚合物 my-list.html:27未捕获的ReferenceError:未定义聚合物 http://localhost:3000/bower_components/page/page.js无法加载资源:服务器响应状态为404(未找到)

任何帮助将不胜感激。谢谢

4 个答案:

答案 0 :(得分:3)

看起来您必须安装项目的依赖项:

npm install -g gulp bower && npm install && bower install

检查"安装依赖项"关于https://github.com/polymerelements/polymer-starter-kit的部分。

答案 1 :(得分:0)

看起来您的服务器没有在正确的目录中运行。

答案 2 :(得分:0)

我的回答是基于我对初学者工具包的确切问题:打开一个仅包含标题的空白页面。您需要使用bower安装Web组件。然后在终端中将目录更改为您的应用程序根目录:

bower install --save Polymer/polymer#^1.0.0

我还建议您使用Yeoman安装Polymer,如果还没有这样做的话。

答案 3 :(得分:0)

在第70行的index.html文件中

* If you intend to serve your app from a non-root path (e.g., with URLs
* like `my.domain/my-app/` and `my.domain/my-app/view1`), edit this line
* to indicate the path from which you'll be serving, including leading
* and trailing slashes (e.g., `/my-app/`).
*/

window.Polymer = {rootPath: '/'};

要解决此问题,只需将rootPath指向应用所在的正确目录,例如

window.Polymer = {rootPath: '/firstapp/'};