polymerpolymer-1.0polymer-cli

polymer-cli build fails for element starter template


I am trying to create a reusable component using polymer cli.

I would like to use this component into another project where i can include it as a single file import.

But when I am trying to build the project, it keeps failing. Below are details of my environment.

$node --version

v4.6.0

$ npm --version

2.15.9

$ polymer --version

0.16.0

$ polymer init
? Which starter template would you like to use? element
info:    Running template element...
? Element name (my-el) 


$polymer build
$ polymer build
info:    Building application...
info:    Generating build/unbundled...
info:    Generating build/bundled...
error:   Uncaught exception: Error: file path is not in root: /Users/yogeshkulkarni/workspace/polymer/polymer/polymer.html (/Users/yogeshkulkarni/workspace/polymer/my-el)
error:   Error: file path is not in root: /Users/yogeshkulkarni/workspace/polymer/polymer/polymer.html (/Users/yogeshkulkarni/workspace/polymer/my-el)
    at Object.urlFromPath (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/path-transformers.js:41:15)
    at StreamAnalyzer.getFile (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:107:39)
    at StreamResolver.accept (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/lib/analyzer.js:210:34)
    at FileLoader.request (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/loader/file-loader.js:64:27)
    at Analyzer.load (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/analyzer.js:121:32)
    at Analyzer._getDependencies (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/analyzer.js:433:25)
    at Analyzer._dependenciesLoadedFor (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/analyzer.js:401:25)
    at Analyzer._parseHTML (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/analyzer.js:227:50)
    at null._onTimeout (/usr/local/lib/node_modules/polymer-cli/node_modules/polymer-build/node_modules/hydrolysis/lib/analyzer.js:125:39)
    at Timer.listOnTimeout (timers.js:92:15)

polymer-cli build works fine when I choose application starter template. Is polymer-cli doesn't support building element starter template?


Solution

  • The docs for polymer-cli state:

    This command is for app projects only.

    And it currently doesn't provide a user-friendly error message for this scenario, so you'll see it crash with a stack trace when building element projects.