首页 文章

尝试运行Polymer Starter Kit时出错

提问于
浏览
1

我正在尝试运行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:未定义Polymer my-list.html:27 Uncaught ReferenceError:未定义Polymer http://localhost:3000/bower_components/page/page.js无法加载资源:服务器响应状态为404(未找到)

任何帮助,将不胜感激 . 谢谢

4 回答

  • 3

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

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

    检查https://github.com/polymerelements/polymer-starter-kit上的"Install dependencies"部分 .

  • 0

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

  • 0

    我的回答是基于我对入门套件的确切问题:只显示一个带有 Headers 的空白页面 . 您需要使用bower安装Web组件 . 然后在终端中将目录更改为您的应用程序根目录:

    bower install --save Polymer/polymer#^1.0.0
    

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

  • 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/'};
    

相关问题