简体   繁体   English

如何通过 pnpm 中的符号链接排除安装包?

[英]How to exclude package from being installed via symlink in pnpm?

I have an Electron project and used pnpm due to it's significant speedup when installing modules over npm or yarn .我有一个 Electron 项目并使用了pnpm因为它在通过npmyarn安装模块时显着加速。

However, 1 module has a problem by being installed via a symlink in the node_modules directory.但是,通过node_modules目录中的符号链接安装1模块存在问题。 Is there any way to exclude a dependency from becoming a symlink?有没有办法排除依赖项成为符号链接?

As far as I understood the documentation, a .npmrc file with the setting below should be enough, but it doesn't work:据我了解文档,具有以下设置的.npmrc文件应该足够了,但它不起作用:

hoist-pattern[]=*nodegit*

As of version 5.14, the only way to avoid symlinks with pnpm is to use the Plug'n'Play feature and set the symlink setting to false.从 5.14 版开始,避免使用pnpm 进行符号链接的唯一方法是使用即插即用功能并将符号链接设置为 false。 You can create a .npmrc in the root of you project with the following content:您可以在项目的根目录中创建一个.npmrc以下内容的.npmrc

node-linker=pnp
symlink=false

Using the hoist settings you can only reduce the number of symlinks, not avoid them.使用提升设置只能减少符号链接的数量,而不能避免它们。 This blog post should explain the different configurations: Node-Modules configuration options with pnpm .这篇博文应该解释不同的配置: Node-Modules configuration options with pnpm With hoist=false , you'll get the minimal amount of symlinks.使用hoist=false ,您将获得最少的符号链接。

Plug'n'Play is known to still have lots of issues, so if it doesn't help, feel free to ask for help in the pnpm discord channel or create an issue in our repository .众所周知,即插即用仍然存在很多问题,因此如果它没有帮助,请随时在pnpm discord 频道中寻求帮助或在我们的存储库中创建问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将项目从 npm 迁移到 pnpm - How to migrate a project from npm to pnpm monorepo 中的 pnpm - 如何仅在特定包中运行命令? - pnpm in monorepo - how to run a command only in a specific package? 在 pnpm 工作区中,如何使用公共 package 的分支的本地副本 - Within a pnpm workspace, how to work with local copy of a fork of a public package 如何从git repo中获取通过NPM安装的软件包的提交哈希? - how can I get the commit hash for a package installed via NPM from a git repo? 未从 Dockerfile 中的 package.json 安装依赖项 (RxJS)? - Dependencies (RxJS) not being installed from package.json in Dockerfile? 如何在 pnpm 中处理 .yarnc? 从注册表安装私有? - How to handle .yarnc in pnpm? Installing private from registry? npm包已经安装在cloudbees上的问题 - Issue with npm package being already installed on cloudbees 如何在猫鼬中排除字段被“ upsert-ed”? - How to exclude fields from being “upsert-ed” in Mongoose? 通过 npm 全局安装的包在 cmd 中不可见 - Package installed globally via npm is not visible in cmd 内部错误:EACCES:权限被拒绝,符号链接 '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm' - Internal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM