PNPM工作区不允许在全新项目上安装依赖项“无法阅读未定义的适当人(Reading'清单')

发布于 2025-01-31 10:27:51 字数 3443 浏览 0 评论 0原文

我正在尝试与Lerna一起使用PNPM来创建MonorePo。不幸的是,在尝试通过PNPM安装Lerna本身时,一切都会失败。

当前项目结构:

“在此处输入图像描述”

lerna.json内容:

{
  "packages": ["functions/*", "libs/*"],
  "version": "0.0.0",
  "npmClient": "pnpm",
  "publish": {
    "ignoreChanges": ["ignored-file", "*.md"],
    "message": "chore(release): publish",
    "registry": "https://npm.pkg.github.com"
  },
}

package.json内容:

{
  "name": "roci-backend",
  "private": true,
  "version": "0.0.0"
}

最后,pnpm-workspace.yaml:

## include
- "functions/**"
- "libs/**"

pnpm版本:7.0.1.1.0.1 节点版本:16.15.0 OS:Win 10

错误消息:

❯ pnpm add -D -w lerna
 ERROR  Cannot read properties of undefined (reading 'manifest')

堆栈跟踪:

"stack": "pnpm: Cannot read properties of undefined (reading 'manifest')\n    at C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120885:49\n    at Array.map (<anonymous>)\n    at C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120882:39\n    at Array.map (<anonymous>)\n    at getImporters (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120878:34)\n    at recursive (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120900:31)\n    at async handler (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:121294:11)\n    at async C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176187:21\n    at async run (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176161:34)\n    at async runPnpm (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176379:5)"

我还尝试安装许多其他旧版本,如5.xx,但完全相同的错误持续存在。

I'm trying to use pnpm with lerna to create a monorepo. Unfortunately it all fails when attempting to install lerna itself via pnpm.

Current project structure:

enter image description here

lerna.json contents:

{
  "packages": ["functions/*", "libs/*"],
  "version": "0.0.0",
  "npmClient": "pnpm",
  "publish": {
    "ignoreChanges": ["ignored-file", "*.md"],
    "message": "chore(release): publish",
    "registry": "https://npm.pkg.github.com"
  },
}

package.json contents:

{
  "name": "roci-backend",
  "private": true,
  "version": "0.0.0"
}

and finally, the pnpm-workspace.yaml:

## include
- "functions/**"
- "libs/**"

pnpm version: 7.0.1
node version: 16.15.0
OS: win 10

Error message:

❯ pnpm add -D -w lerna
 ERROR  Cannot read properties of undefined (reading 'manifest')

Stack trace:

"stack": "pnpm: Cannot read properties of undefined (reading 'manifest')\n    at C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120885:49\n    at Array.map (<anonymous>)\n    at C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120882:39\n    at Array.map (<anonymous>)\n    at getImporters (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120878:34)\n    at recursive (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:120900:31)\n    at async handler (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:121294:11)\n    at async C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176187:21\n    at async run (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176161:34)\n    at async runPnpm (C:\\Users\\Seb\\AppData\\Roaming\\npm\\pnpm-global\\5\\node_modules\\.pnpm\\[email protected]\\node_modules\\pnpm\\dist\\pnpm.cjs:176379:5)"

I have also tried installing many other older versions, as old as 5.xx, but the exact same error persist.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

总以为 2025-02-07 10:27:51

没有Lerna,我也有类似的问题,我们发现的最简单解决方案是使用WSL安装Linux发行版,并从Linux运行时运行PNPM命令。我可以使用Windows 10 Pro,Ubuntu 22 WSL版本:1

I had a similar problem without Lerna and the easiest solution we found was to install a Linux distro with WSL and run pnpm commands from Linux runtime. I got it working with Windows 10 Pro, Ubuntu 22 WSL version: 1

童话 2025-02-07 10:27:51

尽管我有一个不同的设置(带有PNPM工作区的SST项目),但是在尝试在其中一个工作区中安装任何库时,我会出现相同的错误。

该问题在将“版本”添加到工作空间内的package.json文件后消失了,键完全丢失了。

Although I had a different setup (SST project with pnpm workspaces), the same error was popping up for me when trying to install any library in one of the workspaces.

The issue disappeared after adding a "version": "0.0.1" to the package.json file inside the workspace, the key was missing entirely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文