错误类型错误:无法读取未定义的属性“匹配”
Posted
技术标签:
【中文标题】错误类型错误:无法读取未定义的属性“匹配”【英文标题】:ERROR TypeError: Cannot read property 'match' of undefined 【发布时间】:2020-03-19 05:27:51 【问题描述】:npm run build 给出
。
- Building for production...
ERROR TypeError: Cannot read property 'match' of undefined
TypeError: Cannot read property 'match' of undefined
at VuetifyLoaderPlugin.apply (/usr/src/app/node_modules/vuetify-loader/lib/plugin.js:28:29)
at webpack (/usr/src/app/node_modules/webpack/lib/webpack.js:51:13)
at /usr/src/app/node_modules/@vue/cli-service/lib/commands/build/index.js:192:5
at new Promise (<anonymous>)
at build (/usr/src/app/node_modules/@vue/cli-service/lib/commands/build/index.js:191:10)
at async /usr/src/app/node_modules/@vue/cli-service/lib/commands/build/index.js:88:7
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Below is my package.json dependencies:
"dependencies":
"ag-grid-community": "^21.2.2",
"ag-grid-vue": "^21.2.2",
"axios": "^0.19.0",
"core-js": "^2.6.10",
"csvjson": "^5.1.0",
"date-fns": "^2.7.0",
"fabric": "^3.5.0",
"jquery": "^3.4.1",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"vue": "^2.6.10",
"vue-property-decorator": "^8.3.0",
"vue-router": "^3.0.3",
"vue-session": "^1.0.0",
"vuetify": "^2.1.9",
"vuex": "^3.1.2"
,
"devDependencies":
"@vue/cli-plugin-babel": "^3.12.1",
"@vue/cli-plugin-eslint": "^3.12.1",
"@vue/cli-service": "^3.12.1",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.9.0",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"expect": "^24.9.0",
"jest": "^24.9.0",
"jest-transform-stub": "^2.0.0",
"jsdom": "^15.2.1",
"jsdom-global": "^3.0.2",
"mocha": "^6.2.2",
"mocha-webpack": "^1.1.0",
"node-sass": "^4.13.0",
"sass": "^1.23.6",
"sass-loader": "^7.1.0",
"vue-cli-plugin-vuetify": "^0.6.3",
"vue-jest": "^3.0.5",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.3.1",
"webpack-node-externals": "^1.7.2"
npm build 失败,提示未定义的“匹配”。我给出了错误详情和 package.json 文件...
仅供参考,我尝试删除 package-lock.json 和 node_nodules 然后进行安装和构建。但它仍然无法正常工作。
节点:v11.12.0 npm: 6.11.3【问题讨论】:
***.com/questions/59005933 @skirtle 他们似乎修复了它,但它发布了吗?? 【参考方案1】:-
清除 npm 缓存
删除 package-lock.json。
npm 缓存清除 --force
并尝试运行命令:
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
【讨论】:
【参考方案2】:这是 vuetify-loader 中的一个最新错误(请参阅问题 #101)。 该错误已经修复,您可以通过更改以下文件来临时手动修复此错误。
node_modules/vuetify-loader/lib/plugin.js
第 6 行
见change:
- this.options = options
+ this.options = options ||
【讨论】:
【参考方案3】:它对我有用!
vue create new-project
vue add vuetify
但我得到了ERROR TypeError: Cannot read property 'match' of undefined.
和这个commit有关
所以去你的 vue_project/node_modules/vuetify-loader/lib/plugin.js 并手动更改代码
enter image description here
不用担心 Vuetify 团队每周都会发布一次。 已提交修复,因此将在下一个版本中解决
【讨论】:
以上是关于错误类型错误:无法读取未定义的属性“匹配”的主要内容,如果未能解决你的问题,请参考以下文章
无法读取未定义类型错误的属性“推送”:无法读取未定义错误的属性“推送”
错误:`未捕获(承诺中)类型错误:无法读取未定义的属性'doc'`
未捕获的类型错误:无法读取未定义的属性 toLowerCase