tarlepp / angular-sailsjs-boilerplate

'Boilerplate' for AngularJS + Sails.js
MIT License
307 stars 87 forks source link

Frontend: Gulp dist raises "TypeError: bowerStream.pipe is not a function" #101

Open vazarely opened 8 years ago

vazarely commented 8 years ago

I've been using your angular-sails-boilerplate. For frontend development, gulp serve works fine. I'm trying to prepare frontend for production (gulp dist) but get the following error: "TypeError: bowerStream.pipe is not a function"

Stack trace is the following:

[13:05:43] Using gulpfile ~/projects/sails_projects/projectx-frontend/gulpfile.js [13:05:43] Starting 'vendors'... [13:05:44] 'vendors' errored after 30 ms [13:05:44] TypeError: bowerStream.pipe is not a function at Gulp. (/home/vazarely/projects/sails_projects/projectx-frontend/gulpfile.js:112:17) at module.exports (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/index.js:214:10) at Gulp.Orchestrator.start (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/index.js:134:8) at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20 at doNTCallback0 (node.js:407:9) at process._tickCallback (node.js:336:13) at Function.Module.runMain (module.js:477:11) at startup (node.js:117:18) at node.js:951:3

I have the latest frontend commits from 08-Nov-2015 and related module versions as a basis including "main-bower-files": "2.9.0".

Any idea what might be the problem?

smyth64 commented 8 years ago

Hi, You have to remove bowerStream and update the module to mainBowerFiles, then replace all bowerStream.pipe with another code.

I pasted my own code so you can see the lines I changed :)

https://gist.github.com/anonymous/058fa9481464fc7286ea

Am 16.11.15 um 07:29 schrieb vazarely:

I've been using your angular-sails-boilerplate. For frontend development, gulp serve works fine. I'm trying to prepare frontend for production (gulp dist) but get the following error: "TypeError: bowerStream.pipe is not a function"

Stack trace is the following:

[13:05:43] Using gulpfile ~/projects/sails_projects/projectx-frontend/gulpfile.js [13:05:43] Starting 'vendors'... [13:05:44] 'vendors' errored after 30 ms [13:05:44] TypeError: bowerStream.pipe is not a function at Gulp. (/home/vazarely/projects/sails_projects/projectx-frontend/gulpfile.js:112:17) at module.exports (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/index.js:214:10) at Gulp.Orchestrator.start (/home/vazarely/projects/sails_projects/projectx-frontend/node_modules/gulp/node_modules/orchestrator/index.js:134:8) at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20 at doNTCallback0 (node.js:407:9) at process._tickCallback (node.js:336:13) at Function.Module.runMain (module.js:477:11) at startup (node.js:117:18) at node.js:951:3

I have the latest frontend commits from 08-Nov-2015 and related module versions as a basis including "main-bower-files": "2.9.0".

Any idea what might be the problem?

— Reply to this email directly or view it on GitHub https://github.com/tarlepp/angular-sailsjs-boilerplate/issues/101.

tarlepp commented 8 years ago

@smith64fx PR about that change would be nice.

vazarely commented 8 years ago

Hi, @smith64fx Thanks for the tip and code. I applied the changes on lines: 101, 199-201, 210-212, 258, 286, 359, ...and omitted other changes since I don't use jade at the moment.

Result: gulp dist now runs through succesfully [14:36:42] Using gulpfile ~/projects/sails_projects/projectx-frontend/gulpfile.js [14:36:42] Starting 'vendors'... [14:36:42] Starting 'assets'... [14:36:42] Starting 'fonts'... [14:36:42] Starting 'clean-css'... [14:36:42] Starting 'templates-dist'... [14:36:42] Finished 'assets' after 131 ms [14:36:42] Finished 'clean-css' after 195 ms [14:36:42] Starting 'styles'... [14:36:42] Finished 'fonts' after 295 ms [14:36:42] Finished 'styles' after 171 ms [14:36:42] Starting 'styles-dist'... [14:36:42] Finished 'styles-dist' after 135 ms [14:36:42] Finished 'templates-dist' after 508 ms [14:36:42] Starting 'scripts-dist'... [14:37:04] Finished 'scripts-dist' after 22 s [14:37:04] Finished 'vendors' after 23 s [14:37:04] Starting 'dist'... [14:37:05] gulp-inject 2 files into index.html. [14:37:05] gulp-inject 2 files into index.html. [14:37:05] Finished 'dist' after 81 ms

... producing the following to ./dist dir:

There's nothing in ./dist/assets dir.

Gulp production starts OK [14:45:06] Using gulpfile ~/projects/sails_projects/projectx-frontend/gulpfile.js [14:45:06] Starting 'production'... [14:45:06] Finished 'production' after 4.59 ms [14:45:06] Server started at http://:::3000

...BUT there's really nothing visible in http://localhost:3000. Browser keeps waiting for something ("Waiting for localhost") and then finally gives up. No errors in browser console nor in frontend server console. Backend works as it should.

So end result is not as it should be... Any ideas?

vazarely commented 8 years ago

I discovered the problem area:

when I changed lines 199-201 back FROM middleware: function(req, res, next) { return historyApiFallback(req, res, next); }

TO middleware: historyApiFallback({})

and 210-212 back FROM middleware: function(req, res, next) { return historyApiFallback(req, res, next); }

TO middleware: historyApiFallback({})

...everything works now as it should. All gulp serve, gulp dist, and gulp production work ;-)

@smith64fx Thank you again for your help.

asemoon commented 8 years ago

Any plans to merge the fix to the repo?

tarlepp commented 8 years ago

Still waiting that PR