运行ning "npm run build" 时 npm 运行 构建错误
npm run build error when running "npm run build"
在 运行 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:\Projects\Bootstrtao-test> npm run build
> confusion@1.0.0 build I:\Projects\Bootstrtao-test
> npm run clean && npm run imagemin && npm run copyfonts && npm run usemin
> confusion@1.0.0 clean I:\Projects\Bootstrtao-test
> rimraf dist
> confusion@1.0.0 imagemin I:\Projects\Bootstrtao-test
> imagemin img/* --out-dir=dist/img
4 images minified
> confusion@1.0.0 copyfonts I:\Projects\Bootstrtao-test
> copyfiles -f node_modules/font-awesome/fonts/* dist/fonts
> confusion@1.0.0 usemin I:\Projects\Bootstrtao-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:\Projects\Bootstrtao-test\node_modules\usemin\lib\processBlocks.js:39
throw Error('Unsupport format: ' + block.type);
^
Error: Unsupport format: CSS
at I:\Projects\Bootstrtao-test\node_modules\usemin\lib\processBlocks.js:39:10
at Array.forEach (<anonymous>)
at module.exports (I:\Projects\Bootstrtao-test\node_modules\usemin\lib\processBlocks.js:9:9)
at usemin (I:\Projects\Bootstrtao-test\node_modules\usemin\usemin.js:27:42)
at Object.<anonymous> (I:\Projects\Bootstrtao-test\node_modules\usemin-cli\index.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:\Users\PetrosBelachew\AppData\Roaming\npm-cache\_logs20-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:\Users\PetrosBelachew\AppData\Roaming\npm-cache\_logs20-11-20T12_05_10_452Z-debug.log
关于如何解决这个问题有什么想法吗?
我自己解决了这个问题,观察到上面的错误(错误:不支持格式:CSS)。然后检查我的index.html文件,代码是这样的
<!--build:CSS CSS/main.css-->
.....
<!--endbuild-->
在上面这一行,你可以看到 CSS 必须是小写 css.After 我已经解决了我 HTML file.Then 构建中的其他问题成功。
在 运行 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:\Projects\Bootstrtao-test> npm run build
> confusion@1.0.0 build I:\Projects\Bootstrtao-test
> npm run clean && npm run imagemin && npm run copyfonts && npm run usemin
> confusion@1.0.0 clean I:\Projects\Bootstrtao-test
> rimraf dist
> confusion@1.0.0 imagemin I:\Projects\Bootstrtao-test
> imagemin img/* --out-dir=dist/img
4 images minified
> confusion@1.0.0 copyfonts I:\Projects\Bootstrtao-test
> copyfiles -f node_modules/font-awesome/fonts/* dist/fonts
> confusion@1.0.0 usemin I:\Projects\Bootstrtao-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:\Projects\Bootstrtao-test\node_modules\usemin\lib\processBlocks.js:39
throw Error('Unsupport format: ' + block.type);
^
Error: Unsupport format: CSS
at I:\Projects\Bootstrtao-test\node_modules\usemin\lib\processBlocks.js:39:10
at Array.forEach (<anonymous>)
at module.exports (I:\Projects\Bootstrtao-test\node_modules\usemin\lib\processBlocks.js:9:9)
at usemin (I:\Projects\Bootstrtao-test\node_modules\usemin\usemin.js:27:42)
at Object.<anonymous> (I:\Projects\Bootstrtao-test\node_modules\usemin-cli\index.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:\Users\PetrosBelachew\AppData\Roaming\npm-cache\_logs20-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:\Users\PetrosBelachew\AppData\Roaming\npm-cache\_logs20-11-20T12_05_10_452Z-debug.log
关于如何解决这个问题有什么想法吗?
我自己解决了这个问题,观察到上面的错误(错误:不支持格式:CSS)。然后检查我的index.html文件,代码是这样的
<!--build:CSS CSS/main.css-->
.....
<!--endbuild-->
在上面这一行,你可以看到 CSS 必须是小写 css.After 我已经解决了我 HTML file.Then 构建中的其他问题成功。