yeoman / generator-polymer

Scaffold out a Polymer project
http://polymer-project.org
926 stars 149 forks source link

Problems with directory (bower_components) #212

Closed mikkokam closed 9 years ago

mikkokam commented 9 years ago

OSX 10.10.3 npm 2.1.18

npm install -g generator-polymer
mkdir -p my-project && cd $_
yo polymer

All OK so far.

Then

gulp

And I get:

ERROR finding /Users/mikkokam/Documents/git/my-project/dist/bower_components/iron-flex-layout/classes/iron-flex-layout.html

For all the imports in elements.html.

gulp serve

And I get an empty page, plus bunch of 404's in Chrome console, all like this:

http://localhost:3000/bower_components/webcomponentsjs/webcomponents-lite.js Failed to load resource: the server responded with a status of 404 (Not Found)

bower_components seems to be under my-project/src Is this intended? It seems to be the thing that breaks everything.

SOLUTION: Option 1 Fixed gulpfile.js -- there are many tasks pointing to bower_component like this:

var bower = gulp.src([
    'bower_components/**/*'
]).pipe(gulp.dest('dist/bower_components'));

Replacing _'bowercomponents/ with _'src/bowercomponents/ fixes most, page.js is still not found for gulp (vulcanize task).

Option 2 So, I ended up using a quick fix for now: moving _bowercomponents to the top level, next to _nodemodules, and everything works out OK with no changes anywhere else.

robdodson commented 9 years ago

The generator doesn't create a src directory so I'm not sure why you're seeing that. Make sure you've got the latest version installed and try running it in a fresh directory. Also the gulp task creates the dist folder and to serve from there you'll want to run gulp serve:dist. When you run gulp serve you're serving the app directory. Typically you'll want to use gulp serve while you developer and then use gulp followed by gulp serve:dist to preview the final before you deploy.

mikkokam commented 9 years ago

Thanks - I checked on another computer. It did not add the src directory, thus everything works fine on that one. So, this issue can be closed as this seems to be an issue with my Macbook.

That one remains a mystery - yo polymer will always create the src directory and push the bower_components under that.

The difference is, I downloaded the newest Polymer Starter Kit and ran npm install -g gulp bower && npm install && bower install before installing the generator. Npm had some warnings there, so I should probably clean the installations and npm cache on the Macbook.

robdodson commented 9 years ago

Did you run npm install -g generator-polymer? On Aug 6, 2015 2:46 PM, "Mikko Kämäräinen" notifications@github.com wrote:

Thanks - I checked on another computer. It did not add the src directory, thus everything works fine on that one. So, this issue can be closed as this seems to be an issue with my Macbook.

That one remains a mystery - yo polymer will always create the src directory and push the bower_components under that.

The difference is, I downloaded the newest Polymer Starter Kit and ran npm install -g gulp bower && npm install && bower install before installing the generator. Npm had some warnings there, so I should probably clean the installations and npm cache on the Macbook.

— Reply to this email directly or view it on GitHub https://github.com/yeoman/generator-polymer/issues/212#issuecomment-128518826 .

mikkokam commented 9 years ago

Yes - after PSK.

robdodson commented 9 years ago

You shouldn't need to download PSK to use the generator. It spits out a PSK app for you On Aug 6, 2015 9:17 PM, "Mikko Kämäräinen" notifications@github.com wrote:

Yes - after PSK.

— Reply to this email directly or view it on GitHub https://github.com/yeoman/generator-polymer/issues/212#issuecomment-128592722 .