有些坑不知道怎么就掉进去,可能一辈子都爬不起来!!!

一、错误描述

昨天还好好的,今天早上来从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>' ,文件名大小写问题!!!的更多相关文章

  1. 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>' ...

  2. Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#<Object>‘的解决方法

    发现问题 运行一下以前的一个Vue+webpack的 vue仿新闻网站  小项目,报错 由于自己vue学习不深入,老是这个报错,找了好久(确切的说是整整一下午^...^)才找到原因 -v- Uncau ...

  3. [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>',这怎么破? 解 ...

  4. 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 ...

  5. Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

    Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' 点开错误的文 ...

  6. 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 ...

  7. 在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 ...

  8. 关于vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#<Object>'问题的解决方法。

    vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#<Object>'问题的解决方法. 大致是说, ...

  9. Cannot assign to read only property 'exports' of object '#<Object>'

    基本原因是import 和module.exports 是不能混用在.vue的文件里面的 webpack 2中不允许混用import和module.exports module.exports={ 改 ...

随机推荐

  1. C# 动态执行JS

    有时候需要,在程序中灵活的嵌入自定义的计算逻辑,使用C#加载JS脚本形式可以实现: // 添加引用 using Microsoft.JScript; string jsStr = "var ...

  2. k8s记录-国内下载k8s组件镜像

    #!/bin/sh ### 版本信息 K8S_VERSION=v1.13.2 ETCD_VERSION=3.2.24 DASHBOARD_VERSION=v1.8.3 FLANNEL_VERSION= ...

  3. (转)搭建Elasticsearch和kibana环境

    搭建Elasticsearch和kibana环境 作者:IT云清 原文:https://blog.csdn.net/weixin_39800144/article/details/81162002 1 ...

  4. 【论文阅读】FaceBoxes- CPU Real-time Face Detector with High Accuracy

    前言 参考 1. FaceBoxes_paper; 2. Faceboxes_github_tf; 3. 翻译: 4. 理解1: 5. 理解2: 完

  5. spring boot使用WebClient调用其他系统提供的HTTP服务

    WebClient的请求模式属于异步非阻塞,能够以少量固定的线程处理高并发的HTTP请求 WebClient是Spring WebFlux模块提供的一个非阻塞的基于响应式编程的进行Http请求的客户端 ...

  6. linux安装docker,并在docker上运行springboot项目

    docker架构示例图 仓库---> 镜像 --->  容器 一.安装docker 1.通过 uname -r 命令查看你当前的内核版本 uname -r 2使用 root 权限登录 Ce ...

  7. [IOT] - 使用 .Net Core 操作 GPIO 引脚点亮 LED 灯泡

    1. 在 VS 2019 中创建 .Net Core 控制台应用程序,使用 Nuget 安装程序包: System.Device.GpioIot.Device.Bindings 2. 更新 Main ...

  8. 洛谷P1434滑雪讲解

    题源:[戳这里] 洛谷博客链接:[戳这里] 我觉得这道题主要方法应该有两种: 动态规划 搜索 下面会分别对这两种方法进行简述 一,动态规划法首先的想法是用L(i,j)表示从点(i,j)出发能到达的最长 ...

  9. Vue框架(四)——路由跳转、路由传参、cookies、axios、跨域问题、element-ui模块

    路由跳转 三种方式: $router.push / $router.go / router-link to this.$router.push('/course'); this.$router.pus ...

  10. LeetCode二叉树Java模板

    public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } impor ...