当我 运行 我的应用程序时,我的本地服务器找不到 bower 文件
My local server can't find bower files when I run my application
我必须 运行 来自本地存储库(称为 exoplanet-explorer)的应用程序。我安装了 Node.js 和 Git,并按照以下步骤操作:
在Git的命令行中Bash:
git clone https://github.com/udacity/exoplanet.explorer.git
cd exoplanet-explorer
npm install -g gulp bower
npm install && bower install
gulp serve
当我 运行 gulp 服务时,应用程序页面打开但它是空白的。在控制台中出现以下错误列表:
Failed to load resource: the server responded with a status of 404 (Not Found) webcomponents-lite.js:1
(index):1 Refused to execute script from 'http://localhost:5000/bower_components/webcomponentsjs/webcomponents-lite.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
:5000/bower_components/iron-flex-layout/classes/iron-flex-layout.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/iron-pages/iron-pages.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/iron-selector/iron-selector.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-material/paper-material.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-menu/paper-menu.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-scroll-header-panel/paper-scroll-header-panel.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-styles/paper-styles-classes.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-toolbar/paper-toolbar.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
[Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated, and is planned to be removed in M67, around May 2018. Please refer to for possible migration paths.
page.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to execute script from
'http://localhost:5000/bower_components/page/page.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
:5000/bower_components/polymer/polymer.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
planet-thumb.html:78 Uncaught ReferenceError: Polymer is not defined
at planet-thumb.html:78
at planet-thumb.html:100
scale-visualizer.html:68 Uncaught ReferenceError: Polymer is not defined
at scale-visualizer.html:68
at scale-visualizer.html:189
我能做什么?
我在同一个项目上工作,我遇到了完全相同的问题,使用 Windows 10 Home,git 版本 2.15.1.windows.2 和节点 v8.11.3, npm v6.1.0,凉亭 v1.8.4,gulp v3.9.1。我查看了 bower_components 文件夹应该位于的位置,那里绝对没有任何东西。我也以管理员身份打开bash进行安装。
- screenshot of my errors when I first load the page
- screenshot of my errors when I refresh the page
如果您遇到这些错误,无论出于何种原因,Bower 都没有正确安装 polymer-starter-kit,或者您 forgot/failed 自己安装了它。我实际上看到我的安装失败了,因为我会一遍又一遍地安装,键入“bower list”,它会告诉我 polymer 文件在我需要的入门工具包仍未安装 - 但我刚刚看到文件已安装。
- bower list shows the files still NOT being saved to the project
所以我必须做一个“bower install -f polymer-starter-kit”然后安装gulp 并输入 gulp 服务一切正常。希望这对其他人有帮助——我昨天花了 16 个多小时,今天花了 5 个多小时来解决这个问题。 注意:您可能想先执行“bower 缓存清理”。
- bower install -f polymer-starter-kit
- Errors resolved!!!
我必须 运行 来自本地存储库(称为 exoplanet-explorer)的应用程序。我安装了 Node.js 和 Git,并按照以下步骤操作:
在Git的命令行中Bash:
git clone https://github.com/udacity/exoplanet.explorer.git
cd exoplanet-explorer
npm install -g gulp bower
npm install && bower install
gulp serve
当我 运行 gulp 服务时,应用程序页面打开但它是空白的。在控制台中出现以下错误列表:
Failed to load resource: the server responded with a status of 404 (Not Found) webcomponents-lite.js:1
(index):1 Refused to execute script from 'http://localhost:5000/bower_components/webcomponentsjs/webcomponents-lite.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
:5000/bower_components/iron-flex-layout/classes/iron-flex-layout.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/iron-pages/iron-pages.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/iron-selector/iron-selector.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-material/paper-material.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-menu/paper-menu.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-scroll-header-panel/paper-scroll-header-panel.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-styles/paper-styles-classes.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5000/bower_components/paper-toolbar/paper-toolbar.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
[Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated, and is planned to be removed in M67, around May 2018. Please refer to for possible migration paths.
page.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to execute script from
'http://localhost:5000/bower_components/page/page.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
:5000/bower_components/polymer/polymer.html:1 Failed to load resource: the server responded with a status of 404 (Not Found)
planet-thumb.html:78 Uncaught ReferenceError: Polymer is not defined
at planet-thumb.html:78
at planet-thumb.html:100
scale-visualizer.html:68 Uncaught ReferenceError: Polymer is not defined
at scale-visualizer.html:68
at scale-visualizer.html:189
我能做什么?
我在同一个项目上工作,我遇到了完全相同的问题,使用 Windows 10 Home,git 版本 2.15.1.windows.2 和节点 v8.11.3, npm v6.1.0,凉亭 v1.8.4,gulp v3.9.1。我查看了 bower_components 文件夹应该位于的位置,那里绝对没有任何东西。我也以管理员身份打开bash进行安装。
- screenshot of my errors when I first load the page
- screenshot of my errors when I refresh the page
如果您遇到这些错误,无论出于何种原因,Bower 都没有正确安装 polymer-starter-kit,或者您 forgot/failed 自己安装了它。我实际上看到我的安装失败了,因为我会一遍又一遍地安装,键入“bower list”,它会告诉我 polymer 文件在我需要的入门工具包仍未安装 - 但我刚刚看到文件已安装。
- bower list shows the files still NOT being saved to the project
所以我必须做一个“bower install -f polymer-starter-kit”然后安装gulp 并输入 gulp 服务一切正常。希望这对其他人有帮助——我昨天花了 16 个多小时,今天花了 5 个多小时来解决这个问题。 注意:您可能想先执行“bower 缓存清理”。
- bower install -f polymer-starter-kit
- Errors resolved!!!