Skip to content

[docs] Sidecar docs incomplete #3442

@bluewave41

Description

@bluewave41

Following the steps exactly as written on https://v2.tauri.app/learn/sidecar-nodejs/#guide results in

user@Linux:~/Desktop/New Folder/tauri-app/sidecar$ npm run pkg -- --output app
npm error Missing script: "pkg"
npm error
npm error To see a list of scripts, run:
npm error   npm run
npm error A complete log of this run can be found in: /home/user/.npm/_logs/2025-08-04T21_49_37_106Z-debug-0.log

npm create tauri-app@latest

Project name: node-sidecar-lab <-- ignore this just hit enter
Choose which language to use for your frontend: Typescript / Javascript
Choose your package manager: pnpm
Choose your UI template: Vanilla
Choose your UI flavor: Typescript
Would you like to setup the project for mobile as well? yes <-- not applicable anymore
cd tauri-app
npm install
mkdir sidecar
cd sidecar
npm init
npm add @yao-pkg/pkg --save-dev
add the index.js code as stated
npm run pkg -- --output app

Observe error

I needed to add my own build script which isn't mentioned anywhere

"build": "tsc index.ts && pnpm exec pkg index.js --output app && node move.js"

And manually create the src-tauri binaries directory for the given rename script to work.

After that it still doesn't work.

import { Command } from '@tauri-apps/plugin-shell';

const message = 'Tauri';

const command = Command.sidecar('binaries/app', ['ping', message]);
const output = await command.execute();
const response = output.stdout;

tauri.conf.json

"externalBin": ["binaries/app"]

src-tauri/binaries/app-x86_64-unknown-linux-gnu exists

Unhandled Promise Rejection: Scoped command binaries/app not found

https://v2.tauri.app/develop/sidecar/#running-it-from-javascript is required to run sidecars which isn't mentioned anywhere on the nodejs as a sidecar page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🪵 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions