vue 项目运行的时候 出现如下错误 :
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
E:\a项目\hello-vue\node_modules\copy-webpack-plugin\node_modules\schema-utils\dist\validate.js:104
throw new _ValidationError.default(errors, schema, configuration);
^
ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, filter?, transformAll?, toType?, force?, priority?, info?, transform?, transformPath?, noErrorOnMissing? }, ...] (shou
ld not have fewer than 1 item)
at validate (E:\a项目\hello-vue\node_modules\copy-webpack-plugin\node_modules\schema-utils\dist\validate.js:104:11)
at new CopyPlugin (E:\a项目\hello-vue\node_modules\copy-webpack-plugin\dist\index.js:38:31)
at Object.<anonymous> (E:\a项目\hello-vue\build\webpack.dev.conf.js:62:5)
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)
at require (internal/modules/cjs/helpers.js:88:18)
at requireConfig (E:\a项目\hello-vue\node_modules\webpack\bin\convert-argv.js:97:18)
at E:\a项目\hello-vue\node_modules\webpack\bin\convert-argv.js:104:17
at Array.forEach (<anonymous>)
at module.exports (E:\a项目\hello-vue\node_modules\webpack\bin\convert-argv.js:102:15)
at Object.<anonymous> (E:\a项目\hello-vue\node_modules\webpack-dev-server\bin\webpack-dev-server.js:222:50)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
errors: [
{
keyword: 'required',
dataPath: '[0]',
schemaPath: '#/required',
params: { missingProperty: 'patterns' },
message: "should have required property 'patterns'",
schema: {
patterns: { type: 'array', minItems: 1, items: { anyOf: [Array] } },
options: {
type: 'object',
additionalProperties: false,
properties: { concurrency: [Object] }
}
},
parentSchema: {
definitions: {
ObjectPattern: {
type: 'object',
additionalProperties: false,
properties: [Object],
required: [Array]
},
StringPattern: { type: 'string', minLength: 1 }
},
type: 'object',
additionalProperties: false,
properties: {
patterns: { type: 'array', minItems: 1, items: [Object] },
options: {
type: 'object',
additionalProperties: false,
properties: [Object]
}
},
required: [ 'patterns' ]
},
data: {
from: 'E:\\a项目\\hello-vue\\static',
to: 'static',
ignore: [ '.*' ]
},
children: [
{
keyword: 'additionalProperties',
dataPath: '[0]',
schemaPath: '#/additionalProperties',
params: { additionalProperty: 'from' },
message: 'should NOT have additional properties',
schema: false,
parentSchema: {
definitions: [Object],
type: 'object',
additionalProperties: false,
properties: [Object],
required: [Array]
},
data: {
from: 'E:\\a项目\\hello-vue\\static',
to: 'static',
ignore: [Array]
},
children: undefined
},
{
keyword: 'additionalProperties',
dataPath: '[0]',
schemaPath: '#/additionalProperties',
params: { additionalProperty: 'to' },
message: 'should NOT have additional properties',
schema: false,
parentSchema: {
definitions: [Object],
type: 'object',
additionalProperties: false,
properties: [Object],
required: [Array]
},
data: {
from: 'E:\\a项目\\hello-vue\\static',
to: 'static',
ignore: [Array]
},
children: undefined
},
{
keyword: 'additionalProperties',
dataPath: '[0]',
schemaPath: '#/additionalProperties',
params: { additionalProperty: 'ignore' },
message: 'should NOT have additional properties',
schema: false,
parentSchema: {
definitions: [Object],
type: 'object',
additionalProperties: false,
properties: [Object],
required: [Array]
},
data: {
from: 'E:\\a项目\\hello-vue\\static',
to: 'static',
ignore: [Array]
},
children: undefined
}
]
}
],
schema: {
definitions: {
ObjectPattern: {
type: 'object',
additionalProperties: false,
properties: {
from: { type: 'string', minLength: 1 },
to: { anyOf: [Array] },
context: { type: 'string' },
globOptions: { type: 'object' },
filter: { instanceof: 'Function' },
transformAll: { instanceof: 'Function' },
toType: { enum: [Array] },
force: { type: 'boolean' },
priority: { type: 'number' },
info: { anyOf: [Array] },
transform: { anyOf: [Array] },
transformPath: { instanceof: 'Function' },
noErrorOnMissing: { type: 'boolean' }
},
required: [ 'from' ]
},
StringPattern: { type: 'string', minLength: 1 }
},
type: 'object',
additionalProperties: false,
properties: {
patterns: {
type: 'array',
minItems: 1,
items: { anyOf: [ [Object], [Object] ] }
},
options: {
type: 'object',
additionalProperties: false,
properties: { concurrency: { type: 'number' } }
}
},
required: [ 'patterns' ]
},
headerName: 'Copy Plugin',
baseDataPath: 'options',
postFormatter: null
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-vue@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-vue@1.0.0 dev 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\lixia\AppData\Roaming\npm-cache\_logs\2021-05-20T09_06_22_050Z-debug.log
Process finished with exit code 1
依赖项目
"dependencies": {
"@antv/g2plot": "^2.3.21",
"@antv/g6": "^4.3.0",
"axios": "^0.21.1",
"echarts": "^5.1.1",
"element-ui": "^2.15.1",
"insert-css": "^2.0.0",
"node-sass": "^4.14.1",
"vue": "^2.5.2",
"vue-axios": "^3.2.4",
"vuex": "^3.6.2"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "8.2.6",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^8.1.1",
"css-loader": "^5.2.4",
"eslint": "4.19.1",
"eslint-friendly-formatter": "4.0.1",
"eslint-loader": "2.0.0",
"eslint-plugin-vue": "4.7.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"install": "^0.13.0",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^6.0.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"sass-loader": "^7.3.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^4.1.1",
"vue-loader": "^13.3.0",
"vue-router": "^3.5.1",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.8.0",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^2.9.7",
"webpack-merge": "^4.1.0"
},
尝试过修改 webpack版本 还是么有成功
求求各位前端的大佬帮我看看
实际上 copy-webpack-plugin 从 6.0 以后,把配置改成了
new CopyWebpackPlugin(
patterns:
[
{ from: path.resolve(__dirname, './src/assets/'), },
]
),
)
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632