JHipster gulp file error -- Task 'browserify' is not in your gulpfile - jhipster

In the JHipster gulpfile.js, there is a watch task set up for JS files which attempts to call a 'browserify' task. However, there is no 'browserify' task defined. If you are running 'gulp server' during development, the process will terminate as soon as you modify one of your JS files.
[11:43:19] Server started
[11:43:19] LiveReload started on port 35729
[11:43:19] Finished 'server' after 52 ms
**[11:52:14] Task 'browserify' is not in your gulpfile**
[11:52:14] Please check the documentation for proper gulpfile formatting
Is this a bug? I don't see why we would need to call to browserify with the current setup.

Yes it looks like a bug:https://github.com/jhipster/generator-jhipster/issues/367
The Gulp option is a community effort, and is less stable than the Grunt option.
However, of course, our goal is to have a correct and stable Gulp option for our soon-to-be-released 1.0 version.
Can you add your comments and feedback to the opened bug?

Related

Gulp 3 to 4 migration : gulp serve won't start the http server

In an AngularJS 1.7 project, I've managed to migrate my gulp configuration files from 3.9 to 4.0.2, but the http server won't start with a "gulp serve"
I've :
Converted all the dependencies to a "series" task. I used series everywhere, as I think it's safer (and slower) than using parallel execution.
gulp.task('default', ['clean'], function () {
gulp.start('build');
});
to
gulp.task('default', gulp.series(['clean']), function () {
gulp.start('build');
});
Reorder the require('./gulp/somefile.js') manually so that tasks are defined before being called. (before it was loaded by a loop)
within each files put the function definition before the task call them
When I do a "gulp serve", I can see the build output showing the same 'normal' errors I had before migration (non angularjs lib added manually), and some new warning from bootstrap-sass about deprecated division.
After the build part, I would expect a local server to start on port 3000, Chrome being launched with the web UI i'm developping being displayed and my REST call being proxied to a local apache/php server, but well, it doesn't start, no error/warning, nothing.
[00:41:33] Finished 'styles' after 1.6 s
[00:41:33] Finished 'inject' after 2.31 s
[00:41:33] Finished 'watch' after 2.31 s
[00:41:33] Finished 'serve' after 2.31 s
The configuration files are here : https://github.com/dev-mansonthomas/RedCrossQuest/tree/ComposerLibUpdate/client
gulp.js
and then all files in the gulp sub directory.
gulp.start was never really intended for end users and is unneccesary with gulp.series. I wouldn't doubt support for it was removed from v4. Just use:
gulp.task('default', gulp.series('clean', 'build'));

`gulp` command starts, but quits quickly

when I try to run using gulp command, it starts running, but quits after that. How can I make it work as a server?
admins-MacBook-Pro:javascript tester$ ls
bower.json bower_components gulpfile.js lib node_modules package.json
admins-MacBook-Pro:javascript tester$ gulp
[14:37:21] Using gulpfile ~/Documents/cakeshop/cakeshop-client-js/src/main/javascript/gulpfile.js
[14:37:21] Starting 'compile-libs'...
[14:37:21] Starting 'compile-combined'...
[14:37:21] Finished 'compile-libs' after 253 ms
[14:37:24] Finished 'compile-combined' after 3.28 s
[14:37:24] Starting 'compile'...
[14:37:24] Finished 'compile' after 27 μs
[14:37:24] Starting 'default'...
[14:37:24] Finished 'default' after 4.86 μs
admins-MacBook-Pro:javascript tester$
When you just run gulp, the default task is run. According to your output, the default task for your gulpfile depends on the compile-libs, compile-combined, and compile tasks, so those are executed in order.
The available tasks are defined in the gulpfile.js and as such are subject to your particular projects. We cannot tell you whether there is a development server task included or not, and we cannot tell you what it is called either.
You can get a list of available gulp tasks using gulp --tasks. Maybe you can spot a task that starts a server for you; you can then start that using e.g. gulp server. If there is no such task, you will have to write your own, setting up your own server.

Team Build stops and waits for Gulp task to finish

I have an existing nodejs app which i have pushed to the VSTS repository.
I have added three build tasks
npm install - running fine
Gulp - i have a gulpfile in which there is one task which executes "nodemon app.js" command, runs fine but this command starts listening the ports and hence the 3rd task which is the Web App task doesnt gets build. Until and unless Gulp task is built successfully, 3rd task wont get built. for eg "Express server started listening on port 1234" and then the gulp build task is still in running state due to which upfront task doesnt get started.
Some tasks, like nodemon start a background process and will watch the folder for changes. Normally you'd place these under the watch command, then implement a one-pass version of that in the build command.
As long as the Watch is running, control over the process isn't handed back to the Build agent and this will hang your build.
(Re)moving the commands that start watch/monitor processes so they won't get executed during a build is your best solution.

Rebuilding project on gulp.watch has no effect

I have a simple build step of my project where I mainly concatenate several files. The code looks like this:
var gulp = require('gulp');
var p = require('gulp-load-plugins')();
var srcDir = 'src/';
var src=[/*some files here*/];
var header='',footer='';
gulp.task('build',function(){
gulp.src(src,{cwd:srcDir})
.pipe(p.concat('sdk.js'))
.pipe(p.header(header))
.pipe(p.footer(footer))
.pipe(p.jshint())
.pipe(gulp.dest('dist/'));
});
gulp.task('watch',function(){
gulp.watch('src/**/*.js',['build']);
});
gulp.task('default',['build','watch']);
The first build task works as expected, with execution time about 550ms:
[gulp] Starting 'build'...
[gulp] Finished 'build' after 541 ms
However, when I change something in the src folder, the build task takes very little time, although I don't use any caching:
[gulp] Starting 'build'...
[gulp] Finished 'build' after 2.37 ms
What's more, the task has no effect - the dist directory doesn't change. I noticed, however, that the files update when I kill gulp and run it again. I don't know whether it's something with gulp or the file system itself I don't understand.
It turns out that the problem was not associated with gulp - actually it was a problem with my IDE, WebStorm. While the IDE should normally update the files automatically using the mechanism described in this comment to another question
(and it also did in my case not so long ago...). Otherwise it falls back to checking all the files at a time interval. The file was not being updated in my IDE view, but it was already changed by gulp, which worked all the time. Until I fix the issue with automatic reloading, using File | Synchronize results in the up-to-date version of the file being shown.

node.js/karma/end-to-end testing: failed to proxy /app/index.html (Error: connect ECONNREFUSED)

The following are messages I'm getting while trying to run end-to-end test from AngularJS tutorial http://docs.angularjs.org/tutorial/step_05 on MS Windows 8 Professional. Could you please advise how can I make this test running well?
[2013-06-10 17:27:54.100] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: <<< Starting browser Chrome
INFO [launcher]: --- Starting browser Chrome
INFO [Chrome 27.0 (Windows)]: Connected on socket id E20UigDmDqhk3jaRRYAP
WARN [proxy]: failed to proxy /app/index.html (Error: connect ECONNREFUSED)
The error you're seeing indicates that you haven't started the webserver. Since you are using ./scripts/e2e-test.sh to run your e2e tests, you need to have your webserver serve the app from localhost:8000 and the docroot needs point to the angular-phonecat folder, not the app folder. This can be done by simply running ./scripts/web-server.js (see step-00)
Note that there is a second way to run your e2e tests. You can just visit
http://localhost:8000/test/e2e/runner.html
Yes, the problem is that the web server isn't running. Its easiest to run a local one.
See the angular-seed (template project) at https://github.com/angular/angular-seed for details about how to setup a project (from this template) to be able to run testing.
Essentially:
git clone https://github.com/angular/angular-seed
I cloned as 'angular-seed-template-project' and use that as a template for my own projects.
I git pull on this to bring down the latest work and run npm update to pull in its latest dependencies
They actually say to fork angular-seed on git-hub which would allow you to easily git pull to update your project with the latest changes (as per How do I merge a parent fork?). However my understanding is that you can only fork a github project once, which would preclude using angular-seed as a template. Obviously I need to look at this in greater detail.
cd <the-project>
npm test to run the unit tests
npm start to start the web server with the current-dir's app as the base. This will not run as a processs by default so either do that in a different terminal to where you run the command-line commands or start as a process (which is called node that you will need to kill later) - npm start &
npm run update-webdriver to install Selenium and more
npm run protractor to run the end to end integration tests
Doing it this way as per the agile-seed instructions will avoid this error.

Resources