请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

postcss-sprites运行报错

webpack.config.js中代码
const path=require(‘path’)
const ExtractTextWebpackPlugin=require(‘extract-text-webpack-plugin’);
const PurifyCss=require(‘purifycss-webpack’)
const glob=require(‘glob-all’)
const webpack=require(‘webpack’);
module.exports={
entry:{
app:’./src/app.js’
},
output: {
path:path.resolve(__dirname,‘dist’),
// publicPath: ‘./dist/’,
filename: ‘[name].bundle.js’,
chunkFilename: ‘[name].chunk.js’
},
module: {
rules: [
{
test:/.lessKaTeX parse error: Expected 'EOF', got '}' at position 1271: …}) }̲, {…/,
use:[
{
loader: ‘url-loader’,
options:{
name:’[name].min.[ext]’,
limit:10000,
useRelativePath:true
}
},
{
loader: ‘img-loader’,
options:{
pngquant:{
quality:80
}
}
}
]
}
]
},
plugins: [
new ExtractTextWebpackPlugin({
filename: ‘[name].min.css’,
allChunks:false
}),
//注意顺序
new PurifyCss({
paths:glob.sync([
path.join(__dirname,’./.html’),
path.join(__dirname,’./src/
.js’)
])
}),
new webpack.optimize.UglifyJsPlugin()
]
}
package.json中代码
{
“name”: “3-5”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”
},
“keywords”: [],
“author”: “”,
“license”: “ISC”,
“devDependencies”: {
"@babel/core": “^7.2.0”,
"@babel/preset-env": “^7.2.0”,
“babel-loader”: “^7.1.5”,
“babel-plugin-lodash”: “^3.3.4”,
“css-loader”: “^2.0.0”,
“extract-text-webpack-plugin”: “^3.0.2”,
“file-loader”: “^2.0.0”,
“glob-all”: “^3.1.0”,
“img-loader”: “^3.0.1”,
“less”: “^3.9.0”,
“less-loader”: “^4.1.0”,
“node-sass”: “^4.11.0”,
“postcss”: “^7.0.6”,
“postcss-cssnext”: “^3.1.0”,
“postcss-loader”: “^3.0.0”,
“postcss-sprites”: “^4.2.1”,
“purify-css”: “^1.2.5”,
“purifycss-webpack”: “^0.7.0”,
“sass-loader”: “^7.1.0”,
“style-loader”: “^0.23.1”,
“url-loader”: “^1.1.2”,
“webpack”: “^3.12.0”,
“webpack-cli”: “^2.1.5”
},
“dependencies”: {
“lodash”: “^4.17.11”,
“lodash-es”: “^4.17.11”
}
}
运行webpack后,
ERROR in ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/
cjs.js!./src/css/common.less
Module build failed: Error: Invalid file signature
at module.exports.Parser._parseSignature (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\parser.js:50:18)
at module.exports.ChunkStream._processRead (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:
174:13)
at module.exports.ChunkStream._process (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:193:
14)
at module.exports.ChunkStream.write (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:61:8)
at module.exports.ChunkStream.end (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:74:10)
at exports.PNG.PNG.end (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\png.js:98:16)
at exports.PNG.PNG.parse (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\png.js:88:8)
at handlePNG (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:17:7)
at doParse (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:109:7)
at getPixels (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:140:5)
at handleFileBuffer (C:\Users\Administrator\Desktop\3-12\node_modules\pixelsmith\lib\engine.js:45:13)
at ConcatStream. (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\index.js:36:43)
at ConcatStream.emit (events.js:182:13)
at finishMaybe (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\node_modules\readable-stream\lib_strea
m_writable.js:475:14)
at afterWrite (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\node_modules\readable-stream\lib_stream
_writable.js:361:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
@ ./src/css/common.less 2:14-181
@ ./src/app.js

ERROR in ./src/css/common.less
Module build failed: ModuleBuildError: Module build failed: Error: Invalid file signature
at module.exports.Parser._parseSignature (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\parser.js:50:18)
at module.exports.ChunkStream._processRead (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:
174:13)
at module.exports.ChunkStream._process (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:193:
14)
at module.exports.ChunkStream.write (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:61:8)
at module.exports.ChunkStream.end (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:74:10)
at exports.PNG.PNG.end (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\png.js:98:16)
at exports.PNG.PNG.parse (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\png.js:88:8)
at handlePNG (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:17:7)
at doParse (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:109:7)
at getPixels (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:140:5)
at handleFileBuffer (C:\Users\Administrator\Desktop\3-12\node_modules\pixelsmith\lib\engine.js:45:13)
at ConcatStream. (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\index.js:36:43)
at ConcatStream.emit (events.js:182:13)
at finishMaybe (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\node_modules\readable-stream\lib_strea
m_writable.js:475:14)
at afterWrite (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\node_modules\readable-stream\lib_stream
_writable.js:361:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
at runLoaders (C:\Users\Administrator\Desktop\3-12\node_modules\webpack\lib\NormalModule.js:195:19)
at C:\Users\Administrator\Desktop\3-12\node_modules\loader-runner\lib\LoaderRunner.js:364:11
at C:\Users\Administrator\Desktop\3-12\node_modules\loader-runner\lib\LoaderRunner.js:230:18
at context.callback (C:\Users\Administrator\Desktop\3-12\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at Promise.resolve.then.then.catch (C:\Users\Administrator\Desktop\3-12\node_modules\postcss-loader\src\index.js:208:9
)
at process._tickCallback (internal/process/next_tick.js:68:7)
@ ./src/css/common.less
@ ./src/app.js
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/dist/cjs.js!node_m
odules/postcss-loader/src/index.js??postcss!node_modules/less-loader/dist/cjs.js!src/css/base.less:
[0] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dis
t/cjs.js!./src/css/base.less 317 bytes {0} [built]
+ 1 hidden module
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/dist/cjs.js!node_m
odules/postcss-loader/src/index.js??postcss!node_modules/less-loader/dist/cjs.js!src/css/common.less:
[0] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dis
t/cjs.js!./src/css/common.less 1.93 kB {0} [built] [failed] [1 error]

ERROR in ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/d

ist/cjs.js!./src/css/common.less
Module build failed: Error: Invalid file signature
at module.exports.Parser._parseSignature (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\parser.js:50:
18)
at module.exports.ChunkStream._processRead (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream
.js:174:13)
at module.exports.ChunkStream._process (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:
193:14)
at module.exports.ChunkStream.write (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:61:
8)
at module.exports.ChunkStream.end (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\chunkstream.js:74:10
)
at exports.PNG.PNG.end (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\png.js:98:16)
at exports.PNG.PNG.parse (C:\Users\Administrator\Desktop\3-12\node_modules\pngjs\lib\png.js:88:8)
at handlePNG (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:17:7)
at doParse (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:109:7)
at getPixels (C:\Users\Administrator\Desktop\3-12\node_modules\get-pixels\node-pixels.js:140:5)
at handleFileBuffer (C:\Users\Administrator\Desktop\3-12\node_modules\pixelsmith\lib\engine.js:45:13)
at ConcatStream. (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\index.js:36:43)
at ConcatStream.emit (events.js:182:13)
at finishMaybe (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\node_modules\readable-stream\lib_stream_writable.js:475:1
4)
at afterWrite (C:\Users\Administrator\Desktop\3-12\node_modules\concat-stream\node_modules\readable-stream\lib_stream_writable.js:361:3)

    at process._tickCallback (internal/process/next_tick.js:63:19)

正在回答 回答被采纳积分+3

1回答

qbaty 2018-12-19 19:23:54

信息太多,我看到一个是错误的文件签名

Module build failed: Error: Invalid file signature

没有太看懂,还是截图的好些


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信