我正在使用Yarn工作空间处理monoreo。我的后端(使用Nestjs(和当前前端(CRA使用Tailwind,我将来还会添加一个React Native应用程序(工作,我设法修复了我的React应用程序的一些问题,它现在正常启动,但现在我的Nestjs应用程序抛出了有关@types/react
的错误。
以下是我尝试启动后端应用程序时出现的一小部分错误。
../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3244:13 - error TS2717: Subsequent property declarati
ons must have the same type. Property 'view' must be of type 'SVGProps<SVGViewElement>', but here has type 'SVGProps<SVGVi
ewElement>'.
3244 view: React.SVGProps<SVGViewElement>;
~~~~
../node_modules/@types/react/index.d.ts:3245:13
3245 view: React.SVGProps<SVGViewElement>;
~~~~
'view' was also declared here.
../node_modules/@types/react/index.d.ts:3057:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
3057 type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent
<infer T>
~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3054:14
3054 type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticCompo
nent<infer T>
~~~~~~~~~~~~~~~~~~~~~~~~
'LibraryManagedAttributes' was also declared here.
Found 177 error(s).
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
这是我的monopo的配置和结构。
.
├── assets
├── mobile-app
├── mobile-pwa <-- Not yet included in the packages.
├── nest-backend
├── node_modules
├── package.json
├── readme.md
└── yarn.lock
5 directories, 3 files
根的package.json
{
"name": "foo",
"private": true,
"workspaces": {
"packages": ["nest-backend", "mobile-pwa"]
},
"nohoist": ["**/**"]
}
React应用程序的package.json
(由于相当大,将省略一些内容(
{
"name": "@foo/mobile-pwa",
"version": "0.0.1",
"private": true,
"license": "UNLICENSED",
}
和Nest.js后端的package.json
{
"name": "@beextravel/nest-backend",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
}
尝试:
"workspaces": {
"packages": ["nest-backend", "mobile-pwa"],
"nohoist": ["**/**"]
}
来源:https://classic.yarnpkg.com/blog/2018/02/15/nohoist/