Require statement not part of import statement.(@typescript-eslint/no-var-requires)

目录

一、出现Require statement not part of import statement.(@typescript-eslint/no-var-requires)

二、error An unexpected error occurred: "https://github.com/eligrey/FileSaver.js.git/info/refs?service=git-upload-pack: connect ETIMEDOUT 20.205.243.166:443

三、Vue3 忽略 ts (TypeScript)的无故报错

四、Recommendation: math.div(1, 5) More info and automated migrator: https://sass-lang.com/d/slash-div

五、表单初始化数据提示 Property "xxx" was accessed during render but is not defined on instance. 

六、遍历提示错误 'v-model' directives cannot update the iteration variable itself

七、 npm报错:npm ERR! cb.apply is not a function

八、cnpm:无法加载文件,因此在此系统上禁止运行脚本。对注册表项的访问被拒绝。要更改默认作用域的执行策略,请使用“以管理员身份运行”选项启动window powershell。要更改当前用户的执行策略 

九、asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).打包文件体积过大 


一、出现Require statement not part of import statement.(@typescript-eslint/no-var-requires)

1、原因

当在项目中使用了vue、typescript、eslint 后,在vue.config.js 文件中:

const path = require('path')

会提示报错:

Require statement not part of import statement.(@typescript-eslint/no-var-requires)

require部分没有通过import引入,且是@typescript-eslint/no-var-requires检查规则造成。 

2、解决办法:

.eslintrc.js文件中的 rules 属性新增以下内容:

  rules: {
    '@typescript-eslint/no-var-requires': 0
  }

二、error An unexpected error occurred: "https://github.com/eligrey/FileSaver.js.git/info/refs?service=git-upload-pack: connect ETIMEDOUT 20.205.243.166:443

解决办法:

error An unexpected error occurred: “https://github.com/eligrey/FileSaver.js.git/info/refs?service=g_小草莓蹦蹦跳的博客-CSDN博客

 

三、Vue3 忽略 ts (TypeScript)的无故报错

解决办法:

 Vue3 忽略 ts (TypeScript)的无故报错_忽略ts报错_小草莓蹦蹦跳的博客-CSDN博客

 

四、Recommendation: math.div(1, 5) More info and automated migrator: https://sass-lang.com/d/slash-div

解决方法:

将 "sass": "^1.26.5",    替换为  "sass": "~1.26.5",

 

五、表单初始化数据提示 Property "xxx" was accessed during render but is not defined on instance. 

解决办法:

Vue3 实际项目踩坑+总结【汇总篇】_小草莓蹦蹦跳的博客-CSDN博客

六、遍历提示错误 'v-model' directives cannot update the iteration variable itself

解决办法:

Vue3 实际项目踩坑+总结【汇总篇】_小草莓蹦蹦跳的博客-CSDN博客 

七、 npm报错:npm ERR! cb.apply is not a function

npm报错:npm ERR! cb.apply is not a function_小草莓蹦蹦跳的博客-CSDN博客 

八、cnpm:无法加载文件,因此在此系统上禁止运行脚本。对注册表项的访问被拒绝。要更改默认作用域的执行策略,请使用“以管理员身份运行”选项启动window powershell。要更改当前用户的执行策略 

cnpm:无法加载文件,因此在此系统上禁止运行脚本。对注册表项的访问被拒绝。要更改默认作用域的执行策略,请使用“以管理员身份运行”选项启动window powershell。要更改当前用户的执行策略_小草莓蹦蹦跳的博客-CSDN博客

九、asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).打包文件体积过大 

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).打包文件体积过大_小草莓蹦蹦跳的博客-CSDN博客 

 

### 如何使用 Keil5 Hex 文件 对于仅拥有已编译好的 hex 文件而无源文件的情况,在 Keil V5 平台上直接hex 文件至单片机(如华大单片机)需采取特定的方法,因为直接调用该平台进行此类操作不可行[^1]。 #### 设置 Output 路径 进入 Keil 的 output 设置界面,指定要录的 hex 文件的具体位置。确保在路径输入框中填完整的 hex 文件名称并附带 `.hex` 扩展名;缺少此扩展名可能导致系统继续尝试录先前编译的结果而非所选的 hex 文件[^3]。 #### 配置 Flash 工具选项 针对不同类型的微控制器(MCU),可能还需调整 flash 下载工具的相关配置参数以匹配目标设备的要求。这一步骤通常涉及选择合适的编程算法以及设定通信接口等细节[^2]。 #### 启动下载过程 完成上述准备工作之后,可以通过点击调试窗口内的 “Download” 或者快捷菜单里的相应命令来启动实际的程序入流程。如果一切顺利的话,软件会自动连接硬件并将选定的 hex 数据传输到 MCU 中存储起来[^4]。 ```python # Python 示例代码用于说明自动化脚本概念 (并非真实实现) def download_hex_to_mcu(hex_file_path, mcu_type): """ 自定义函数模拟将 HEX 文件下载到指定型号的 MCU 上 参数: hex_file_path -- 完整路径字符串指向待上传的 .hex 文件 mcu_type -- 字符串表示的目标单片机类型标识符 返回值: 成功则返回 True ,失败抛出异常信息 """ try: configure_output_settings(hex_file_path) # 设定输出设置 select_flash_tool(mcu_type) # 挑选适合的闪存工具 execute_download_command() # 发送下载指令 return True # 表明成功结束 except Exception as e: raise RuntimeError(f"Failed to upload {hex_file_path}: {e}") ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值