运行 "npm run build" 时出现 npm 运行生成错误



运行npm run build时出错:有人能帮我解决这个问题吗。

Package.json文件:

{
"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/* --out-dir=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 imagemin && npm run copyfonts && npm run usemin"
},
"author": "",
"license": "ISC",
"devDependencies": {
"cssmin": "^0.4.3",
"htmlmin": "0.0.7",
"lite-server": "^2.5.4",
"micromatch": "^4.0.2",
"node-sass": "^4.14.1",
"onchange": "^3.3.0",
"parallelshell": "^3.0.1",
"rimraf": "^2.6.2",
"uglify-js": "^3.11.6",
"usemin-cli": "^0.6.0"
},
"dependencies": {
"bootstrap": "^4.0.0",
"bootstrap-social": "^5.1.1",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"popper.js": "^1.12.9"
}
}

错误

PS I:ProjectsBootstrtao-test> npm run build
> confusion@1.0.0 build I:ProjectsBootstrtao-test
> npm run clean && npm run imagemin && npm run copyfonts && npm run usemin

> confusion@1.0.0 clean I:ProjectsBootstrtao-test
> rimraf dist

> confusion@1.0.0 imagemin I:ProjectsBootstrtao-test
> imagemin img/* --out-dir=dist/img
4 images minified
> confusion@1.0.0 copyfonts I:ProjectsBootstrtao-test
> copyfiles -f node_modules/font-awesome/fonts/* dist/fonts

> confusion@1.0.0 usemin I:ProjectsBootstrtao-test
> 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
I:ProjectsBootstrtao-testnode_modulesuseminlibprocessBlocks.js:39
throw Error('Unsupport format: ' + block.type);
^
Error: Unsupport format: CSS
at I:ProjectsBootstrtao-testnode_modulesuseminlibprocessBlocks.js:39:10
at Array.forEach (<anonymous>)
at module.exports (I:ProjectsBootstrtao-testnode_modulesuseminlibprocessBlocks.js:9:9)
at usemin (I:ProjectsBootstrtao-testnode_modulesuseminusemin.js:27:42)
at Object.<anonymous> (I:ProjectsBootstrtao-testnode_modulesusemin-cliindex.js:52:12)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion@1.0.0 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`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion@1.0.0 usemin script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersPetrosBelachewAppDataRoamingnpm-cache_logs2020-11-20T12_05_10_237Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion@1.0.0 build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersPetrosBelachewAppDataRoamingnpm-cache_logs2020-11-20T12_05_10_452Z-debug.log

关于如何解决这个问题有什么想法吗?

在观察到上面的错误(错误:不支持的格式:CSS(后,我自己解决了这个问题。然后检查了我的index.html文件

<!--build:CSS CSS/main.css-->
.....
<!--endbuild-->

在上面的这一行中,您可以看到CSS必须是小写CSS。之后,我解决了HTML文件中的其他问题。然后构建成功了。

相关内容

  • 没有找到相关文章

最新更新