Everytime I get an Assertion error while running gulp in command line(每次在命令行中运行 gulp 时出现断言错误)
本文介绍了每次在命令行中运行 gulp 时出现断言错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我正在尝试运行下面的命令,但不幸的是我遇到了错误.
I'm trying to run the command below but unfortunately I run into an error.
运行上述命令后出现断言错误.我再次重新安装了 gulp 和 npm,但得到了同样的错误.我的节点版本-v10.15.0吞咽版本-CLI 版本 2.0.1本地版本 4.0.2
I got assertion error after running the above command. I reinstalled gulp and npm once again but got the same error.
My node version-v10.15.0
gulp version-
CLI version 2.0.1
Local version 4.0.2
我使用 Windows 10 操作系统和 VS Code 作为编辑器.
I m Using Windows 10 Operating System and VS Code as an editor.
gulp.js 文件:
gulp.js file:
package.json 文件
package.json file
{
"name": "confusion",
"version": "1.0.0",
"description": "This is a website for Ristorante Con Fusion",
"main": "index.html",
"scripts": {
"start": "npm run watch:all",
"test": "echo "Error: no test specified" && exit 1",
"lite": "lite-server",
"scss": "node-sass -o css/ css/",
"watch:scss": "onchange "css/*.scss" --npm run scss",
"watch:all": "parallelshell "npm run watch:scss" 'npm run lite'",
"clean": "rimraf dist",
"copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
"imagemin": "imagemin img/* -o dist/img",
"usemin": "usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist --htmlmin -o dist/index.html",
"build": "npm run clean && npm run copyfonts && npm run imagemin && npm run usemin"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.7",
"cssmin": "^0.4.3",
"del": "^3.0.0",
"grunt-browser-sync": "^2.2.0",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^2.2.1",
"grunt-contrib-htmlmin": "^2.4.0",
"grunt-contrib-imagemin": "^3.1.0",
"grunt-contrib-uglify": "^3.3.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-filerev": "^2.3.1",
"grunt-sass": "^2.1.0",
"grunt-usemin": "^3.1.1",
"gulp": "^4.0.2",
"gulp-sass": "^3.1.0",
"htmlmin": "0.0.7",
"jit-grunt": "^0.10.0",
"lite-server": "^2.3.0",
"node-sass": "^4.12.0",
"onchange": "^6.0.0",
"parallelshell": "^3.0.2",
"rimraf": "^2.6.2",
"time-grunt": "^1.4.0",
"uglifyjs": "^2.4.11",
"usemin-cli": "^0.5.1"
},
"dependencies": {
"bootstrap": "^4.3.1",
"bootstrap-social": "^5.1.1",
"font-awesome": "^4.7.0",
"grunt": "^1.0.4",
"jquery": "^3.4.1",
"popper.js": "^1.12.9"
}
}
我已经包含 gulp.js 和 package.json 文件.
I've include gulp.js and package.json file.
推荐答案
您在 gulp4 文件中使用 gulp3 语法.
You are using gulp3 syntax in a gulp4 file.
搜索你的错误信息Task function must be specified
,你会得到很多点击.
Search your error message Task function must be specified
and you will get lots of hits.
更改这些行:
和
到
看起来您正在学习旧的 gulp3 教程,但请寻找一些从 gulp3 到 gulp4 的迁移指南.
It looks like you were working off of an old gulp3 tutorial but look for some migration guides from gulp3 to gulp4 instead.
这篇关于每次在命令行中运行 gulp 时出现断言错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!