Tag Archives: gulp

GulpThe following tasks did not complete [How to Solve]

The code is as follows:

//Reference the gulp module
const gulp = require('gulp');
// use gulp.task() to create the task
gulp.task('first', () => {
    console.log('The first gulp task was executed');

    // the files to be processed // output the processed files to the dist directory
    gulp.src('./src/css/base.css')
        .pipe(gulp.dest('./dist/css'));

});

Error reporting:

[01:26:16] The following tasks did not complete: first
[01:26:16] Did you forget to signal async completion?

Reason:

This is a problem caused by the anonymous callback function when gulp 4.0 uses task. Gulp no longer supports synchronization tasks

A relatively simple method is to add a callback to indicate the completion of the function

That is, the code is modified to:

//Reference the gulp module
const gulp = require('gulp');
// use gulp.task() to create the task
gulp.task('first', (cb) => {
    console.log('The first gulp task was executed');

    // the files to be processed // output the processed files to the dist directory
    gulp.src('./src/css/base.css')
        .pipe(gulp.dest('./dist/css'));
    cb();
});

 

The results of the run are as follows.

PS C:\Users\User\Desktop\nodejs\gulp-demo> gulp first [01:34:28] Using gulpfile ~\Desktop\nodejs\gulp-demo\gulpfile.js
[01:34:28] Starting ‘first’…
The first gulp task executed
[01:34:28] Finished ‘first’ after 9.06 ms
PS C:\Users\User\Desktop\nodejs\gulp-demo>

When installing gulp, you are always prompted that you are missing modules (cannot find module ‘gulp load plugins’)

What are the eight life cycle hook functions of Vue>>>

We have to consider two situations

1. Install gulp locally and globally

npm i -g gulp && npm i --save-dev gulp

2. Create a new package.json and fill in the missing module name manually

My method is like this, prompt what module is missing, direct global installation, once installed, it will prompt the latest version number, at this time, as long as we fill in the correct version number

Finally, run it again

npm install

then operate

gulp

Solution to the problem of bash: gulp: command not found after installing gulp in Windows system

Why are there a series of technical challenges behind “OMG buy it”>>>

When using the gulp server command, bash: gulp: command not found appears
first of all, when I saw this command, I doubted that my gulp was not installed properly. I executed it again NPM install - G gulp , but the command ran smoothly, and the result still appeared: bash: gulp: command not found
then I found the following article on the Internet
I feel that the direction to solve the problem is right. The command of gulp is invalid. It should be the configuration problem. Then I go to the global directory (C: program files/nodejsnode)_ modules/npm/node_ Modules) to see if my gulp package is installed, and it is not! My bag succeeded, but it was in the wrong place

1. Use the command to check: NPM config get prefix , and the following figure is obtained

looking at the location, it seems that it is the address that I configured when I used the lower version of node.. But now NPM has been integrated into node. I can’t find the configuration address myself. Anyway, there is absolutely no environment variable. Now I just want to correct the address and go to the new path I follow C:// program files/nodejs/node_ modules\npm

2. Use the command to modify the configuration

npm config set prefix C:\Program Files\nodejs\node_ As we all know, the file name of the program files in the middle is very hollow, which causes the command to be interrupted in this way. So I went to the configuration file to modify it manually (this is a simple and direct way). The file location is here C:// users/administrator (see the figure below)

3. Check the configuration of NPM again

as can be seen from the above figure, the configuration address now points to NPM in node, and then install gulp to see
running commands: NPM install - G gulp and gulp - V