Polymer 1.0:<neon-animated-pages> 的 Bower 更新

Polymer 1.0: Bower update for <neon-animated-pages>

Question/s

  • How do I update my web-animations-js/ directory (using Bower?) to support <neon-animated-pages>?

  • Do I even need to do this update in the first place?

背景

1。已验证我的导入并确认代码有效。

,我确认我使用的是正确的导入 <neon-animated-pages> 以正常工作。

2。但是我收到控制台错误。

但是,现在当我使用确切的 code shown in this JSBin 时,我收到以下控制台错误

控制台错误信息
Uncaught TypeError: Cannot read property 'cancel' of null
web-animations-next-animation.js:37

所以也许我没有安装所有 Bower 依赖项...

3。目录内容似乎表明缺少文件。

检查我的 bower_components/web-animations-js/ 目录的内容,我看到以下文件结构。

web-animations-js/ 目录文件结构
web-animations-js/
  |-- .bower.json
  |-- bower.json
  |-- COPYING
  |-- History.md
  |-- README.md
  |-- web-animations-next-lite.min.js
  |-- web-animations-next-lite.min.js.map
  |-- web-animations-next.min.js
  |-- web-animations-next.min.js.map
  |-- web-animations.html
  |-- web-animations.min.js
  |-- web-animations.min.js.gz
  |-- web-animations.min.js.map

所以我想我需要更新我的 web-animations-js/ 目录以包含控制台错误引用的 web-animations-next-animation.js 文件。

4。这就是我尝试过的方法。

我已经尝试了以下所有终端命令。

终端命令
$ bower update --save web-animations/web-animations-js
$ bower update --save web-animations-js
$ bower install --save web-animations/web-animations-js
$ bower install --save web-animations-js

但我在每种情况下都得到了这样的回应:bower: command not found

So what should I do next?

下一步,恕我直言,是在您的计算机上安装 Bower。

如果您收到 bower: command not found 回复,可能是因为您尚未安装 Bower 或 Bower 不在路径中。

要安装 bower,您需要安装 npm,然后执行以下终端命令:

$ npm install -g bower

(如果你的 npm install 是以 root 身份进行的,你可能需要以 root 身份才能执行前面的命令)

那应该安装 bower 并将其放在路径中。

您可以通过执行以下命令来验证 Bower 是否已安装:

$ bower help

当 Bower 将安装并运行时,您可以执行 bower update 命令。

我在根级别重新安装了 Bower,并下载了新版本的 Polymer Starter Kit。这似乎已经解决了核心问题并且 <neon-animated-pages> 正在工作。

请注意,我首先下载了 PSK,但没有先重新安装 Bower,它没有工作,因为 bower_components PSK 安装中省略了目录。所以我不得不先重新安装 Bower。然后就正常了。