[react]Duplicate identifier ‘LibraryManagedAttributes‘.

news/2024/7/15 19:03:15 标签: react.js

problem

获取开源react项目,一顿操作: npm install, npm run start

页面报错:

@types/react/index.d.ts
Duplicate identifier ‘LibraryManagedAttributes’.

reason

应该是依赖原因

solution

改为yarn安装
rm -rf node_modules
yarn install

修改配置
yarn remove @types/react-dom @types/react
yarn add -D @types/react-dom @types/react

重启
yarn run start


http://www.niftyadmin.cn/n/1463064.html

相关文章

[ts] .vite/vue.js oes not provide an export named ‘PropType‘

enviroment vite vue3 set-up mode error import {defineProps, PropType, ref, computed} from "vue"; defineProps({titleInfo: {type: Object as PropType<TitleInfo

[typescript] 无法重新声明块范围变量“user”。test_function.ts(75, 5): ‘user‘ was also declared here.

error 定义重复 函数实现重复 无法重新声明块范围变量“user”。test9_function.ts(75, 5): ‘user’ was also declared here. reason 原因是同一个文件夹下&#xff0c;其它文件里有同样的变量定义 resolution 在 Typescript 中&#xff0c;只要文件存在 import 或 expo…

[typescript] ERROR TS18003: No inputs were found in config file ‘tsconfig.json‘. Specified ‘include‘

reason src目录下没有.ts文件 resolution 在src目录下新增一个空的test.ts文件即可

[typescript] Experimental support for decorators is a feature

error 用到typescrip装饰器语法&#xff0c;使用命令tsc进行编译时&#xff0c;报错如下 Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option in your ‘tsconfig’ or ‘jsconfi…

[typescript] ts-loader! Module build failed: Error: Could not find source file:

reason 个人理解:在控制台看到原本admin/index.vue 自动转成了 admin/index.vue.ts resolution 解决办法: {test: /\.vue$/,loader: vue-loader,options: {loaders: {css: vue-style-loader!css-loader

[ts] typeof ‘string‘ can not be used index type

error typescript使用场景&#xff1a;用变量作为object的key取值&#xff0c;语法报错 typeof ‘string’ can not be used index type solution 指定object的key的类型即可 obj: { [k:string]: string } 报错代码&#xff1a; 正常代码&#xff1a;

cannot find name ‘__dirname‘.ts

environment vite vue3 error @vite.config.ts export default defineConfig({plugins: [vue()],resolve: {alias: {// error: cannot find name __dirname.ts

[typescript] ERROR TS18002: The ‘files‘ list in config file ‘tsconfig.json‘ is empty.

reason 网上可搜到的解决办法是修改webpack配置,显示指定tsconfig.json 个人理解:这样做意外着webpack没有找到配置文件,并不是报错中说的files选项为空 但修改配置后并没解决整个报错 {test: /\.tsx?$/,loader: "ts-loader",exclude: /node_modules/,options: