Registry / devops / minecraft-bedrock-server

minecraft-bedrock-server

JSON →
library1.5.2jsnpmunverified

The `minecraft-bedrock-server` package provides a robust JavaScript API and a command-line interface (CLI) for programmatically managing Minecraft Bedrock Edition servers. It simplifies the process of downloading, starting, stopping, and configuring a Bedrock Dedicated Server instance. The package automatically fetches official server binaries directly from minecraft.net, supporting both Windows and Linux versions. As of its latest stable release, 1.5.2, the project demonstrates an active development cadence with frequent patch updates. Key differentiators include its dual CLI/API approach, direct integration with Minecraft's official download channels for server binaries, and flexible configuration options for `server.properties` directly via code or CLI arguments, making it suitable for automated server deployments or custom game launchers.

npm install minecraft-bedrock-server
INSTALL
IMPORT
SIG · MINECRAFT-BEDROCK-
M
minecraft-bedrock-server
devopsjavascriptv1.5.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

startServer
import { startServer } from 'minecraft-bedrock-server';
const startServer = require('minecraft-bedrock-server').startServer;
Preferred modern ESM import for type safety and tree-shaking. The package ships TypeScript types.
getLatestVersions
import { getLatestVersions } from 'minecraft-bedrock-server';
const getLatestVersions = require('minecraft-bedrock-server').getLatestVersions;
Use named import for `getLatestVersions` to fetch available server binaries.
CLI usage
npx minecraft-bedrock-server --version latest --online --path ./my-bedrock-server
node node_modules/minecraft-bedrock-server/index.js --version latest
`npx` is the recommended way to run the CLI without a global install. `--path` is crucial for managing server files.

This quickstart demonstrates how to programmatically fetch the latest Minecraft Bedrock server version, create a dedicated server instance directory, and start the server with custom `server.properties` options. It uses environment variables for port configuration and logs the server's process ID upon successful startup.

import { startServer, getLatestVersions } from 'minecraft-bedrock-server'; import * as path from 'path'; import * as fs from 'fs'; async function runBedrockServerExample() { // Define a dedicated path for the server files const serverInstancePath = path.join(__dirname, 'bedrock_server_instance'); // Ensure the server directory exists if (!fs.existsSync(serverInstancePath)) { fs.mkdirSync(serverInstancePath, { recursive: true }); console.log(`Created server instance directory: ${serverInstancePath}`); } console.log('Fetching latest Minecraft Bedrock server versions...'); const versions = await getLatestVersions(); const latestLinuxVersion = versions.linux?.version3; // Using version3 for common display if (!latestLinuxVersion) { console.error('Could not determine latest Linux server version from minecraft.net.'); return; } console.log(`Attempting to start Minecraft Bedrock Server version ${latestLinuxVersion} in ${serverInstancePath}...`); const onServerStart = () => { console.log('Minecraft Bedrock Server started successfully!'); console.log(`Server is listening. Connect to localhost:${process.env.BEDROCK_PORT ?? 19132}`); }; const serverOptions = { 'server-port': process.env.BEDROCK_PORT ?? 19132, 'online-mode': true, path: serverInstancePath, 'level-name': 'myAwesomeWorld', 'max-players': 10 // Any other server.properties options can be passed here }; // The startServer function handles downloading the server binary if not present const serverProcess = await startServer(latestLinuxVersion, onServerStart, serverOptions); console.log(`Server process PID: ${serverProcess.pid}`); // In a real application, you would manage the serverProcess (e.g., stdin/stdout, graceful shutdown). // For this quickstart, the server will run until the Node.js process exits. } runBedrockServerExample().catch(console.error);
bedrock-server --version
Debug
Known issues
gotchaThe package downloads and executes an external Minecraft Bedrock Dedicated Server binary. Users must ensure their system has the necessary dependencies (e.g., `unzip` on Linux) and appropriate file execution permissions for the downloaded binary. Failure to do so can result in the server failing to start.
fix
Install `unzip` if on Linux (`sudo apt-get install unzip` or similar). Check the console output for specific errors related to binary execution or missing dependencies. Ensure the target directory for the server has write/execute permissions.
affects: >=1.0.0
gotchaNot specifying a dedicated `path` option when starting a server can lead to server files (world data, logs, `server.properties`) being scattered across the current working directory. This can cause clutter, data loss, or conflicts if multiple servers are managed.
fix
Always provide a unique and dedicated directory using the `path` option (e.g., `{ path: './servers/my-world-server' }`) for each server instance to ensure proper file isolation and management.
affects: >=1.0.0
gotchaMinecraft Bedrock server versions are highly specific. Relying on an outdated version or expecting features from one version to work identically on another can lead to unexpected behavior or server startup failures. The `latest` keyword fetches the most recent *stable* version, but specific versions might be required for certain clients or features.
fix
Explicitly define the desired server version (e.g., `'1.20.72.01'`) when calling `startServer` if precision is required. Use `getLatestVersions()` to dynamically retrieve the most up-to-date information.
affects: >=1.0.0
Errors
Common errors & fixes
Error: spawn EACCES
The downloaded Minecraft Bedrock server executable does not have sufficient permissions to run.
fix
Ensure the directory where the server binary is downloaded (specified by the `path` option) has execute permissions. You might need to manually run `chmod +x <path_to_server_binary>` if the automatic download doesn't set it correctly on Linux/macOS.
Error: spawn <binary_name> ENOENT
The underlying Bedrock server executable was not found, failed to download, or essential system dependencies (like `unzip`) are missing.
fix
Verify that `unzip` is installed on your system (for Linux/macOS). Check the console output during the `startServer` call for any download failures. Ensure the `path` option points to a writable directory where the binary can be extracted.
Address already in use
The default server ports (19132 for IPv4, 19133 for IPv6) are already occupied by another application or another instance of the Minecraft Bedrock server.
fix
Specify an alternative port for the server using the `server-port` option in the server configuration object (e.g., `{ 'server-port': 25565 }`). Use system tools (like `netstat` or `lsof`) to identify and stop processes occupying the desired ports.
Upgrade
Version history
1.5.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
minecraft-bedrock-server — npm install minecraft-bedrock-server · libregistry