Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lerna + dumi + yarn workspace 拉包报错 [ERR_PACKAGE_PATH_NOT_EXPORTED] #1964

Closed
cx91 opened this issue Nov 21, 2023 · 5 comments
Closed

Comments

@cx91
Copy link

cx91 commented Nov 21, 2023

Version

2.2.14

OS Version

macOS 14.1.1

Node.js Version

16.19.0

Browser Version

Chrome 119.0.6045.159

Link to minimal reproduction

Steps to reproduce

yarn: 1.22.19
lerna: 7.4.2
拉包直接报错
image

What is expected?

拉包成功

What is actually happening?

拉包直接报错

Any additional comments? (optional)

lerna 6.4.1版本是对的,升级到7.4.2就报错了,但在lerna issues那边没有相关资料

@FrankXiong
Copy link

FrankXiong commented Apr 3, 2024

我也遇到了这个问题+1
pnpm@8.15.4、lerna@7.4.2、dumi,执行dumi build报错 Error: Package subpath './package.json' is not defined by "exports" in /xxx/node_modules/lerna/package.json

@cx91
Copy link
Author

cx91 commented Apr 3, 2024

我也遇到了这个问题+1 pnpm@8.15.4、lerna@7.4.2、dumi,执行dumi build报错 Error: Package subpath './package.json' is not defined by "exports" in /xxx/node_modules/lerna/package.json

不知道官方有关注到这个问题没,我只使用lerna拉包就没问题

@Lincoln-xzc
Copy link

这个问题解决了吗?

@cx91
Copy link
Author

cx91 commented Sep 12, 2024

这个问题解决了吗?

没有呢,你也遇到了吗?

@cx91
Copy link
Author

cx91 commented Oct 10, 2024

刚刚在dumi沟通群中,咨询大佬,找到问题点了
1、由于我目录结构的问题,所以我项目中加了一个插件, 增加alias将pakages下的 npm 包 link 到 dumi demo中
2、lerna 6.4.1 在package.json中没有暴露 exports 字段, 7+ 暴露了
2、那个插件是我去dumi1.x里面拷的,里面有句代码引起的报错
const { version: lernaVersion } = require('lerna/package.json');

解决方案:
按官方的推荐 参考 antv/g6的 monorepo 结构直接将 dumi 目录作为 monorepo 子包, 不再会有这个 alias 的问题,也就可以不用再增加这个插件了

@cx91 cx91 closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants