plutoless / eEducation

e-education solutions(Agora Reference Design)
184 stars 124 forks source link

npm run dev启动报错 #124

Closed chenbj123 closed 4 years ago

chenbj123 commented 4 years ago

E:/zxdzWorkspace/education_web/src/components/form-input.tsx TypeScript error in E:/zxdzWorkspace/education_web/src/components/form-input.tsx(32,8): Type '{ children: never[]; className: string; value: any; onChange: (evt: any) => void; }' is not assignable to type 'IntrinsicAttributes & InputProps'. Property 'children' does not exist on type 'IntrinsicAttributes & InputProps'. TS2322

30 |     <>
31 |       <InputLabel>{props.Label}</InputLabel>

32 | <Input className={classes.formInput} value={props.value} | ^ 33 | onChange={onChange}> 34 | 35 | {props.requiredText ? {props.requiredText} : null}

Matrixbirds commented 4 years ago

这个报错的问题是在material-ui用了低版本的type declaration,引起的解决方案是升级@material-ui的2个库。

  1. 检查下你的 @material-ui 2个库的版本是不是4.9.1 "@material-ui/core": "4.9.1", "@material-ui/icons": "4.9.1",

  2. 使用以下的命令 重新安装一下依赖

    cd 到你的web项目目录
    rm -rf package-lock.json && rm -rf node_modules && npm cache verify && npm i --registry=https://registry.npm.taobao.org/