温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/docs/pm/cli/link
点击访问原文链接

bun link - Bun

bun link - BunDocumentation Index

Fetch the complete documentation index at: /docs/llms.txt

Use this file to discover all available pages before exploring further.

Skip to main contentBun home pageSearch...⌘KInstall BunSearch...NavigationWorkspace Managementbun linkRuntimePackage ManagerBundlerTest RunnerGuidesReferenceBlogFeedback:first-child]:!hidden peer-[.is-custom]:[&>:first-child]:sm:!hidden peer-[.is-custom]:[&>:first-child]:md:!hidden peer-[.is-custom]:[&>:first-child]:lg:!hidden peer-[.is-custom]:[&>:first-child]:xl:!hidden">Core Commandsbun installbun addbun removebun updatebunxPublishing & Analysisbun publishbun outdatedbun whybun auditbun infoWorkspace ManagementWorkspacesCatalogsbun linkbun pmAdvanced Configurationbun patchbun --filterGlobal cacheGlobal virtual storeIsolated installsLockfileLifecycle scriptsScopes and registriesOverrides and resolutionsSecurity Scanner API.npmrc supportOn this pageUnlinkingCLI UsageInstallation ScopeDependency ManagementProject Files & LockfilesInstallation ControlNetwork & RegistryPerformance & ResourceCachingOutput & LoggingPlatform TargetingGlobal Configuration & ContextHelpWorkspace Managementbun linkCopy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_n4ctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed">*]:[overflow-wrap:anywhere]">

Link local packages for development

Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_1cctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed">Use bun link in a local directory to register the current package as a “linkable” package. terminal
cd /path/to/cool-pkg
cat package.json
bun link
bun link v1.3.3 (7416672e)
Success! Registered "cool-pkg"

To use cool-pkg in a project, run:
bun link cool-pkg

Or add it in dependencies in your package.json file:
"cool-pkg": "link:cool-pkg"
This package can now be “linked” into other projects using bun link cool-pkg. This will create a symlink in the node_modules directory of the target project, pointing to the local directory. terminal
cd /path/to/my-app
bun link cool-pkg
In addition, the --save flag can be used to add cool-pkg to the dependencies field of your app’s package.json with a special version specifier that tells Bun to load from the registered local directory instead of installing from npm: package.json
{
"name": "my-app",
"version": "1.0.0",
"dependencies": {
"cool-pkg": "link:cool-pkg"
}
}
​Unlinking Use bun unlink in the root directory to unregister a local package. terminal
cd /path/to/cool-pkg
bun unlink
bun unlink v1.3.3 (7416672e)
​CLI Usage
bun link packages>
​Installation Scope ​--globalbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Install globally. Alias: -g ​Dependency Management ​--productionbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Don’t install devDependencies. Alias: -p ​--omitstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Exclude dev, optional, or peer dependencies from install ​Project Files & Lockfiles ​--yarnbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Write a yarn.lock file (yarn v1). Alias: -y ​--frozen-lockfilebooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Disallow changes to lockfile ​--save-text-lockfilebooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Save a text-based lockfile ​--lockfile-onlybooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Generate a lockfile without installing dependencies ​--no-savebooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Don’t update package.json or save a lockfile ​--savebooleandefault:"true"p:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Save to package.json (true by default) ​--trustbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Add to trustedDependencies in the project’s package.json and install the package(s) ​Installation Control ​--forcebooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Always request the latest versions from the registry & reinstall all dependencies. Alias: -f ​--no-verifybooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Skip verifying integrity of newly downloaded packages ​--backendstringdefault:"clonefile"p:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Platform-specific optimizations for installing dependencies. Possible values: clonefile (default), hardlink, symlink, copyfile ​--linkerstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Linker strategy (one of isolated or hoisted) ​--dry-runbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Don’t install anything ​--ignore-scriptsbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Skip lifecycle scripts in the project’s package.json (dependency scripts are never run) ​Network & Registry ​--castringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Provide a Certificate Authority signing certificate ​--cafilestringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Same as —ca, but as a file path to the certificate ​--registrystringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Use a specific registry by default, overriding .npmrc, bunfig.toml, and environment variables ​--network-concurrencynumberdefault:"48"p:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Maximum number of concurrent network requests (default 48) ​Performance & Resource ​--concurrent-scriptsnumberdefault:"5"p:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Maximum number of concurrent jobs for lifecycle scripts (default 5) ​Caching ​--cache-dirstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Store & load cached data from a specific directory path ​--no-cachebooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Ignore manifest cache entirely ​Output & Logging ​--silentbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Don’t log anything ​--quietbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Only show tarball name when packing ​--verbosebooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Excessively verbose logging ​--no-progressbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Disable the progress bar ​--no-summarybooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Don’t print a summary ​Platform Targeting ​--cpustringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Override CPU architecture for optional dependencies (e.g., x64, arm64, * for all) ​--osstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Override operating system for optional dependencies (e.g., linux, darwin, * for all) ​Global Configuration & Context ​--configstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Specify path to config file (bunfig.toml). Alias: -c ​--cwdstringp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Set a specific current working directory ​Help ​--helpbooleanp:first-child]:mt-0 [&_.prose>p:last-child]:mb-0" data-component-part="field-content">Print this help menu. Alias: -h

Was this page helpful?

YesNoSuggest editsRaise issueCatalogsPreviousbun pmNext⌘IxgithubdiscordyoutubePowered byThis documentation is built and hosted on Mintlify, a developer documentation platform

bun link - Bun,AI智能索引,全网链接索引,智能导航,网页索引

    Link local packages for development