generator-angular
generator-angular copied to clipboard
generator-angular error with gulp
When using Gulp with angular-generator
I received error :
task 'wiredep' is not in you gulpfile
I tried running the build using gulp
and received error :
TypeError: $.useref.restore is not a function
try replace .pipe($.useref.restore()) by .pipe($.useref.assets().restore())
@benjipott that works but gulp bower
still doesn't.
if you change the .bowerrc file to look for the bower_components inside the app folder gulp bower
works
bowerrc doesnt specify where to look for the components; it specifies where to place them. we moved them out of the app folder so there is something else going on
I replace directory: yeoman.app + './bower_components'
,
by directory: 'bower_components'
,
then gulp bower
works
gulp.task('bower', function () {
return gulp.src(paths.views.main)
.pipe(wiredep({
directory: 'bower_components',
ignorePath: '..'
}))
.pipe(gulp.dest(yeoman.app));
});
replace all task code
@kevinwon1985 that seems to work except now angular isnt found in my project when i do gulp serve, is there something else i have to do?
@9mm try this repository to instead your generator-angular, I has work on this bugs recently, and pull request, but not merged yet now.
I am getting a similar error that @aerlaut reported. When I build with gulp I receive an error that reads:
$.useref.assets is not a function
Here is the code referenced in the error:
.pipe($.useref.assets({searchPath: [yeoman.app, '.tmp']}))
Try using the master branch from here and see if that works
Check this https://github.com/jonkemp/gulp-useref/issues/153
What's going on with this? Can't find bower files... is this a useref problem?
gulp-useref v3 does not have assets() function, and "philosophy" is a bit different.
In order to fix this, you have to re-write whatever code you have (Info from here: https://www.npmjs.com/package/gulp-useref see bottom, how TO),
OR
just make sure that you are using older version of gulp-useref, in your packages.json:
"gulp-useref": "~1.1.1",
Is this being patched in a new version? I just started using Yeoman, did a fresh install of yeoman, npm, bower, and generator-angular and I ran into the same issues, gulp bower
fails, I changed the gulpfile to point to directory: 'bower_components',
and now gulp_bower works, but angular is still undefined in the project.
I'm still having issues as well, same story as @ChrisPenner
@ChrisEelmaa I changed my packages.json to use "gulp-useref": "~1.1.1"
but angular is still undefined.
I also made the change that @kevinwon1985 mentioned, it fixed gulp bower
but again angular is still undefined when I try and run the application.
I was hoping to build a new application at work using gulp and yeoman but I might have to move another way. Would appreciate any insight.
Hi, I made the followings and now gulp serve
seems to work fine:
- in the
.bowerrc
file I changed:"directory": "bower_components"
to"directory": "app/bower_components"
- deleted the
bower_components
folder - rerun
bower install
- in the
gulpfile.js
around the 146th line ingulp.task('bower', function () {
I changed:.pipe(gulp.dest(yeoman.app + '/views'));
to.pipe(gulp.dest(yeoman.app));
The problem was not only that the gulpfile referenced the bower_components in the wrong folder, but that the index file was modified, but was created in the views folder.
I am not sure that it will solve all the problems, but gulp serve
works.
bower_components should not be in /app
since that is for your application files, not 3rd party files.
Just uploaded a PR with solves this almost the way @szantner did but with out modifying the location of the bower_components
folder (with as explained by @eddiemonge is not a good practice). I had to modify also the bower
task to point to the bower_components
folder correctly and also removing the ../bower_components
prefix from imported filed and thus, had to modify the start:server
and start:server:test
to serve also the bower_components
folder.
It turned out my first approach broke the main build process... I now changed it so that serve tasks use a middleware to serve the bower_components
folder, that is much safer also.
1st issue, yeoman build is referring to gulp wiredep not gulp bower:
rename gulp.task('bower', function () ...
to { gulp.task('wiredep', function () { ...
2nd issue is that bower libs are not in the directory: yeoman.app + '/bower_components'
, but in directory: 'bower_components'
,
3rd issue .pipe(gulp.dest(yeoman.app + '/views'));
is not in the views folder but the .pipe(gulp.dest(yeoman.app ));
So long story short, replace gulp.task('bower', function ...
with:
gulp.task('wiredep', function () { return gulp.src(paths.views.main).pipe(wiredep({ directory: 'bower_components', ignorePath: '..' })).pipe(gulp.dest(yeoman.app)); });
Delete the dist folder, run gulp wiredep
, gulp
and gulp serve
or add wiredep task to the build one.
Hope this clarifies it.
The question has been discussed here for any future references: http://stackoverflow.com/a/36073950/1242321
ok, have many fixes, but officially (from Yeoman) nothing??
last release: 11 Dec 2015 '¬¬
check @ksgupta's stackoverflow link to get the bug free gulpfile! 💯 💯