Polymer 1.0:从命令行安装 Polymer Starter Kit 会抛出错误

Polymer 1.0: Installing Polymer Starter Kit from command line throws error

How do I fix this so I can install the Polymer Starter Kit?

命令:

$ yo polymer

抛出以下错误:

readline.js:924
                        throw err;
                        ^

Error: Cannot find module 'yeoman-environment'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:289:25)
        at Module.require (module.js:366:17)
        at require (module.js:385:17)
        at Object.<anonymous> (/usr/local/lib/node_modules/generator-polymer/node_modules/yeoman-generator/index.js:7:19)
        at Module._compile (module.js:425:26)
        at Object.Module._extensions..js (module.js:432:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:313:12)
        at Module.require (module.js:366:17)
        at require (module.js:385:17)

版本配置

工具链:

$ node -v
v5.1.1

$ npm -v
3.5.1

$ yo --version
1.5.0

$ bower --version
1.6.9

$ grunt --version
grunt-cli v0.1.13

$ gulp --version
CLI version 3.9.0

全局安装 Yeoman 聚合物生成器。

$ cd
$ sudo npm install --global generator-polymer
# or
$ sudo npm install -g generator-polymer

然后在项目目录下安装 Yeoman Polymer-generator。

$ cd path/to/project
$ sudo npm install --global generator-polymer
# or
$ sudo npm install -g generator-polymer