This is the 10th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

The next day, White faced a new challenge — Jenkins couldn’t pack successfully.

Now let’s repeat the whole process of solving the problem.

Have a problem

Jenkins with low access reported an error

wget: missing URL

Operation and Maintenance reported an error to Jenkins

gulp: command not found

Small white: rightness rightness! I added a new package command gulp && webpack -p. My dependency configuration is in package.json file, Jenkins should have installed it voluntarily when compiling.

O&m: How to install dependencies?

Xiao Bai: I execute NPM I locally.

O&m: script to execute the NPM I try.

Maximum Call Stack Size exceeded

Small white: confused, ask my leadership.

Direct manager: what is the local Node version and gulp version respectively? The node version may be inconsistent with the gulp version.

Xiao Bai: Node version 10, gulp version 3.9.1.

Jenkins: Node is 12, gulp is 4, please update gulp and change the syntax.

Node 12.0 or later does not support gulp4.0 or earlier

To solve the problem

Upgrade gulp to version 4.0, and upgrade gulp syntax to version 4.0

View the local gulp version

gulp -v
Copy the code

Xiao Bai: It’s 3.9.1, right.

Uninstall gulp of an earlier version and upgrade gulp to a later version

npm uninstall gulp
npm install --save-dev gulp
Copy the code

At this time, the gulp version is upgraded to 4.0.2.

Upgrade the local node to a version later than 12

The n command installs the specified version of node

Sudo n 12.22.7Copy the code

Execute the package command (execute the command according to your package.json file configuration)

npm run build
Copy the code

Task function must be specified

Xiaobai: syntax error, open gulp official website.

Replace gulp syntax to 4.0

Example:

Gulp. task(‘default’, [‘htmlmin’, ‘cssmin’, ‘jsmin’, ‘copy’]); Gulp.task (‘default’, gulp.series(‘htmlmin’, ‘cssmin’, ‘jsmin’, ‘copy’));

Execute the package command again

npm run build
Copy the code

Xiao Bai: Success! Push the code!

Xiao Bai: Jenkins still failed to pack, the error is the same as before, it seems not caused by this reason, ask the leader for help.

Direct leadership: lack of package, NPM I try.

Maximum Call Stack Size exceeded

Small white: meng force in…

Jenkins did not check the NPM install option when packing.

Small white:?? The NPM install option may have been configured previously. You cannot repeat NPM install in the script.

NPM I = Maximum Call Stack Size exceeded; node12 only supports gulp4.0 or higher; Perhaps this problem is not solved, the NPM I problem is the next problem.

Sometimes you have to believe what you see.

Gulp 3.0 upgrade to gulp 4.0 Task grammar modify references: www.jianshu.com/p/c30ff8592…

Previous versions of Node: nodejs.org/zh-cn/downl…