Cannot assign to read only property 'exports' of object '#<Object>' ,文件名大小写问题!!!
有些坑不知道怎么就掉进去,可能一辈子都爬不起来!!!
一、错误描述
昨天还好好的,今天早上来从git获取了一下别人提交的代码就出错了!而提交代码的人 运行一点错误都没有!!!
cya@KQ-101 MINGW64 /e/Source/Repos/ProjectManagement/WebUI (master) //这行是vscode自动显示的。
$ npm run dev //($ 是自动显示的,dev是我取的别名)
1)浏览器报错
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
at Module.<anonymous> (BaseClient.js:23)
at Module../node_modules/webpack-dev-server/client/clients/BaseClient.js (BaseClient.js:38)
at __webpack_require__ (bootstrap:767)
at fn (bootstrap:130)
at Module.<anonymous> (SockJSClient.js:73)
at Module../node_modules/webpack-dev-server/client/clients/SockJSClient.js (SockJSClient.js:121)
at __webpack_require__ (bootstrap:767)
at fn (bootstrap:130)
at Object../node_modules/webpack-dev-server/client/socket.js (socket.js:52)
at __webpack_require__ (bootstrap:767)
2)vscode 终端报错:
eslint 报错,例如:
Errors:
13 http://eslint.org/docs/rules/no-redeclare
5 http://eslint.org/docs/rules/no-unused-vars
1 http://eslint.org/docs/rules/no-empty
1 http://eslint.org/docs/rules/no-undef
Module Warning (from ./node_modules/eslint-loader/index.js):
✘ http://eslint.org/docs/rules/no-unused-vars 'width' is assigned a value but never used
src\views\dataResource\dataCatalog\index.vue:314:13
const width = catalogListContainer.offsetWidth
大概就是: 请查Ctrl+左键,去 eslint看各种文档 **已经定义或引用,但是从来没有被使用。
其实根本不是eslint的问题。
3)
二、解决方案: 将大写 WebUI 改为小写webui

然后,就好了!!!
相当于: cya@KQ-101 MINGW64 /e/Source/Repos/ProjectManagement/webui (master)
四、无效的尝试:
1)根据浏览器报错百度得:
https://www.cnblogs.com/qingqingzou-143/p/7028683.html?utm_source=itdadao&utm_medium=referral
文章说:在webpack打包的时候,可以在js文件中混用require和export。但是不能混用import 以及module.exports 。
但这显然不符合我的实际,因为我和同事代码完全相同。
2) 删除本地代码,重新重gitee(码云)上获取代码。最后与同事相同的代码;
3)node.js 卸载、重装;最后与同事一个版本;
4) 发现npm文件两个地方都有,一个是node里自带的,node卸载时会删除;另一个在系统盘的npm文件里直接删除了。最后与同事一个版本;
5)eslint 包单独卸载,重装。
6)删除 node_modules 文件,然后执行 npm install ,重新安装所有的包文件。
7)怀疑每次npm install 包里面文件版本不同,百度发现 package-lock.json ,发现该配置文件保证了包版本的一致性。
https://www.cnblogs.com/cangqinglang/p/8336754.html
https://www.cnblogs.com/kugeliu/p/9153775.html
8)继续猜想原因:webpack 问题。
对比浏览器报错代码,发现编译后的内容不同!
错误的:

多出两个文件!
(webpack)
(webpack)-dev-server
正确的是:

联想到:会不会是名称不一致问题???
三、总结:
解决方式:完全是瞎尝试。
无法向后端那样调试锁定错误源头,作为渺小后端开发人员感到前端知识缺口太大,感到前端框架、包、项目代码巨大的不可控性。报错,但错误提示语句与错误源头相距十万八千里!!!
根本原因:没找到。为什么昨天文件名大写完全正确,今天却导致错误?
直接原因:昨天还好好的,今天早上来从git获取了一下别人提交的代码就出错了!而且同事也获取了代码,但是一点错误都没有!!!
Cannot assign to read only property 'exports' of object '#<Object>' ,文件名大小写问题!!!的更多相关文章
- Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' ...
- Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#<Object>‘的解决方法
发现问题 运行一下以前的一个Vue+webpack的 vue仿新闻网站 小项目,报错 由于自己vue学习不深入,老是这个报错,找了好久(确切的说是整整一下午^...^)才找到原因 -v- Uncau ...
- [one day one question] webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>'
问题描述: webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>',这怎么破? 解 ...
- Vue 使用自定义组件时报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
自己试做了一下vue的插件 参考element-ui: 写了一个组件 import message from './packages/message/index.js'; const install ...
- Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' 点开错误的文 ...
- vue运行报错error:Cannot assign to read only property 'exports' of object '#<Object>'
用weex做项目的时候,npm start 之后一直报错error:Cannot assign to read only property 'exports' of object '#<Obje ...
- 在Vue中使用i18n 国际化遇到 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
最近用Vue在搭建前端框架,在引用i18n时,运行的时候报错:Uncaught TypeError: Cannot assign to read only property 'exports' of ...
- 关于vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#<Object>'问题的解决方法。
vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#<Object>'问题的解决方法. 大致是说, ...
- Cannot assign to read only property 'exports' of object '#<Object>'
基本原因是import 和module.exports 是不能混用在.vue的文件里面的 webpack 2中不允许混用import和module.exports module.exports={ 改 ...
随机推荐
- Lamda OrderBy 排序问题
var itemModel = itemList.OrderBy(s=> decimal.Parse(s.Price)).ToList(); 前端传递的list数据金额或者其他非数字类型的字段最 ...
- LeetCode 112. Path Sum(路径和是否可为sum)
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...
- React.lazy和React.Suspense异步加载组件
在React16.6中引入了React.lazy和React.Suspense,这两个组件,可以用来实现异步加载组件. 例如: const johanComponent = React.lazy(() ...
- postman 用环境变量Environment实现多服务器版本
现存问题 在测试API期间,往往存在多种环境,对应IP地址(或域名也不同) 比如: Prod: http://116.62.25.57/ucows 用于开发完成发布到生产环境 Dev: http:// ...
- org.apache.hadoop.fs.FsUrlStreamHandlerFactory 在哪个jar包
org.apache.hadoop.fs.FsUrlStreamHandlerFactory在org.apache.hadoop类中,org.apache.hadoop在hadoop安装目录下.
- 一次升级jar包遇到的空指针异常
今天自己在升级公司的一个jar后,一直报空指针异常.代码如下 package com.zhuanche.http; import com.alibaba.fastjson.JSON; import c ...
- 配置windows live writer
下载地址 https://pan.baidu.com/s/1WVpLQEadIHN15W2DIhWh4A 安装流程参考博客 https://www.cnblogs.com/haseo/p/376232 ...
- ETF计算公式:IOPV
IOPV=(申购.赎回清单中必须现金替代的替代金额+申购.赎回清单中退补现金替代成份证券的数量与最新成交价相乘之和+申购.赎回清单中可以现金替代成份证券的数量与最新成交价相乘之和+申购.赎回清单中禁止 ...
- 图文讲解Android ImageView的ScaleType
ScaleType的设置方式包括: 1. 在layout的xml中定义android:scaleType="xxx": 2. 在java代码中调用imageView.setScal ...
- [ERROR ]Failed to execute goal org.codehaus.mojo:flatten-maven-plugin:1.1.0:flatten (flatten) on project
今天在启动项目的时候,莫名的Maven install命令的时候出现错误 错误提示:Failed to execute goal org.codehaus.mojo:flatten-maven-plu ...