For the complete documentation index, see llms.txt. This page is also available as Markdown.

21.7 Node.js Development Environment

Node.js depends on a specific version of /lib/libcrypto.so. Before installing on FreeBSD, the base system must be updated first.

Updating the Base System

Node.js installed via pkg depends on a specific version of the /lib/libcrypto.so.xxx file. When using Node.js on FreeBSD, you need to pay attention to the FreeBSD system version, especially when pkg is configured to use the latest repository.

Before installing Node.js on FreeBSD, the base system should be updated first.

Installing npm or yarn will automatically install the corresponding version of Node.js; Bun uses its own runtime and does not depend on Node.js.

Node.js Package Manager Comparison

Evaluation Dimension
npm
Yarn
Bun

Underlying language

JavaScript

JavaScript

Zig

Execution runtime

Node.js

Node.js

Native Bun Runtime

Dependency resolution

Flat dependency tree + hoisting

node_modules / Plug'n'Play (PnP)

High-concurrency install + flat node_modules

Disk storage strategy

Physical node_modules

node_modules or PnP virtual resolution

Global cache + hard link/clone optimization

Lock file

package-lock.json

yarn.lock

bun.lock

TypeScript support

Depends on tsc / tsx / esbuild etc.

Same as npm

Native .ts execution

Compatibility

Node.js official standard

High compatibility

Node API compatibility still needs improvement

Bun is a JavaScript runtime, not just a Node.js package manager.

Bun

Install using pkg:

Or install using Ports:

Yarn

Install using pkg:

Or install using Ports:

NPM

Install using pkg:

Or install using Ports:

Switching NPM Registry on FreeBSD

Set npm to use a domestic mirror to speed up downloads:

This site is the former Taobao mirror. For details, see https://npmmirror.com, which provides NPM Chinese mirror acceleration services.

Troubleshooting and Unfinished Business

ld-elf.so.1 Error

If you skip updating the FreeBSD base system and install software directly, you may encounter the following error:

Note

The libcrypto.so.111 in the above error message corresponds to OpenSSL 1.1.1 (FreeBSD 13 and earlier). In FreeBSD 14, the base system's OpenSSL has been upgraded to 3.x, with the corresponding library file being libcrypto.so.30; in FreeBSD 15 and later, the corresponding library file is libcrypto.so.35. The error message will differ, but the root cause is the same: the base system needs to be updated first.

Ports compile based on the current system's library version, so installing via Ports compilation will not produce the above issue.

Last updated