各种错误合集

代码报错和包错误


.bind(this) 会引起表单验证组件转圈
组件在转,又可能是字段重名
state里面用了= 可能导致模块加载失败 也就是ADD不存在

包错误

1

PS C:\Users\apple\Desktop\C\dva-quickstart> npm install antd babel-plugin-import --save
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\apple\AppData\Roaming\npm-cache\_logs\2021-06-24T06_26_40_361Z-debug.log

原因:

npm版本问题,可以去提示的那个npm目录里面查看日志,你可以尝试一下更新一下npm的版本,或回退一下版本。

解决方法:

更新npm版本命令:
npm install npm -g 要记住全局更新
淘宝镜像命令:cnpm install npm -g 淘宝镜像会比较快
再查看一下npm版本:npm -v

2

PS C:\Users\apple\Desktop\C> npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\apple\Desktop\C/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\apple\Desktop\C\package.json'    
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\apple\AppData\Local\npm-cache\_logs\2021-06-24T08_17_33_028Z-debug.log 

Antd的组件和model的值,不能取到,也就是说,this.props.model.table.id会报id不存在的错误,具体会出现在设置默认选项的时候defaultSecteleKeys,目前不知道应该怎么办,先放着

n

有一个问题,建立了类以后再使用

const FormPage = () => (
  <Form labelCol={{ span: 4 }}>
    <Form.Item label="Photos" name="photos">
      <AliyunOSSUpload />
    </Form.Item>
  </Form>
);

怎么拿到(高阶组件传递父子组件函数可以解决)

   <Modal visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
          <img alt="example" style={{ width: '100%' }} src={this.state.previewImage} />
        </Modal>

[React/Error: Minified React error #130]

https://blog.csdn.net/yyy72999/article/details/79412981

From.creat()不用的话,直接链接DVA就会导致getFileDecorator未定义

https://cloud.tencent.com/developer/article/1442680

这家伙有点问题

同协议、同域名(或IP)、以及同端口视为同域。两个页面的协议、域名和端口(若指定了端口)相同,则视为同源。下表给出了相对http://www.aliyun.com/org/test.html的同源检测示例:

逗号回导致model的报错

http://dd-test.gcnao.cn/gateway/application/menu/update

组件在转,又可能是字段重名

state里面用了= 可能导致模块加载失败 也就是ADD不存在

公共组件里面对图片进行异步上传等待拿到uid,

    <FormItem
      {...formItemLayout}
      label="Dragger"
    >
      <div className="dropbox">
        {getFieldDecorator('dragger', {
          valuePropName: 'fileList',
          getValueFromEvent: this.normFile,
        })(
          <Upload 
          listType="picture-card"                       //上传列表的内建样式

          beforeUpload={beforeUpload}           //尺寸什么的

          name="files" 
          action="/upload.do"
          >
            <p className="ant-upload-drag-icon">
              <Icon type="inbox" />
            </p>
          </Upload>
        )}
      </div>
    </FormItem>

这里有玄学,晚点要写文档

if (Array.isArray(e)) {
  return e;
}
return e && e.fileList;

熟练掌握

beforeUpload 有毒

getFieldsValue 一定要有这个值才能赋,否则未定义

当函数的参数没有返回就渲染这个函数的时候,会容易出现错误,所以进行参数的if判断

git 错误

PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp> git push origin main
fatal: unable to access 'https://github.com/indredK/AntdProMyApp.git/': OpenSSL SSL_read: Connection was aborted, errno 10053

解决方法:
1、更改网络认证设置

git config --global http.postBuffer 524288000 

2、更改网络认证设置,然后更改一下代理(可以参考这篇文章

PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp> git config --global http.sslVerify "false"
PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp> git push origin main
fatal: unable to access 'https://github.com/indredK/AntdProMyApp.git/': Failed to connect to github.com port 443 after 21102 ms: Timed out
PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp> git push origin main
fatal: unable to access 'https://github.com/indredK/AntdProMyApp.git/': Failed to connect to github.com port 443 after 21039 ms: Timed out
PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp> git config --global http.proxy 127.0.0.1:1080
PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp> git push origin main
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 12 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 773 bytes | 773.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To https://github.com/indredK/AntdProMyApp.git
   b4589aa..678e3c3  main -> main
PS E:\httpsgithub.comindredKAntdProMyApp.git\AntdProMyApp\myapp>

create-react-app 后如果没有安装antd,又用了antd的组件就会报 Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
如果使用了ref或者钩子函数,可能会有严格限制,这个时候只要删除react.StrictMode就可以了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值