sentry-cli: command not found after upgrading to v4
In v3, installing @sentry/cli gave you the sentry-cli command. A CI job could install the package in one step and
run sentry-cli in the next.
An unpinned install can now pick up v4 under that same package name. The install succeeds and gives you sentry.
When the next step calls sentry-cli, the shell can’t find it. The same thing happens on PyPI, where v4 is still
published as sentry-cli.
npm install -g sentry is the new npm install command for v4. Your script still needs to call sentry and use the
v4 flags. If you need the old script to run as written, pin the CLI to v3.
Check what CI installed
After the install, check which commands the failing step can find.
command -v sentry-cli || true command -v sentry || truecommand -v sentry-cli || true command -v sentry || true
Use sentry --version to check the version. If you see both commands, look at the paths. You may have v3 installed
globally and v4 in the project.
If the CLI is in package.json, run npm ls @sentry/cli sentry --depth=0 in the project directory. I ran npm ci
with @sentry/cli@4.0.1 in the lockfile. The npm script failed with sh: 1: sentry-cli: not found, and
./node_modules/.bin/sentry --version printed 4.0.1.
If sentry is in node_modules/.bin, run it from an npm script or use its path. npm run adds that directory to
PATH. If the file is missing, check whether you installed dev dependencies. npm ci --omit=dev skips them.
If you installed it with pip, run python -m pip show sentry-cli in the Python environment the job uses.
Upload source maps with v4
Change sentry-cli sourcemaps upload to sentry sourcemap upload. You can run it with npx on Node.js 20 or newer.
Use the directory with your built JavaScript and .map files in place of ./dist.
npx --yes sentry@4 sourcemap upload ./dist \ --org YOUR_ORG --project YOUR_PROJECT \ --waitnpx --yes sentry@4 sourcemap upload ./dist \ --org YOUR_ORG --project YOUR_PROJECT \ --wait
If the CLI is a project dependency, replace @sentry/cli with sentry in package.json and change the command in
your npm script.
If npm install -g sentry fails with EEXIST for bin/sentry, check whether @sentry/cli@4 already owns that file.
Remove the old global package with npm uninstall -g @sentry/cli, then install sentry.
Upload flags in v4
If your old command used --auth-token or --url, set SENTRY_AUTH_TOKEN or SENTRY_URL in the job environment.
Version 4.0.1 reports No flag registered for those flags.
Each upload takes one --project. Passing it twice gives Too many arguments for --project. If you send the same
build to several projects, run the command once per project.
If your v3 script used --wait-for 600, use --wait=600 in v4. The = matters. With --wait 600, the CLI reads
600 as a positional argument. In CI, v4 waits for processing even if you leave out --wait.
The upload adds missing debug IDs to the JavaScript and maps. If you ran sentry-cli sourcemaps inject to add those
IDs, you can drop that step. Upload before you deploy so the JavaScript you serve contains the IDs in the uploaded
maps.
For Bugsink, set SENTRY_URL to your Bugsink URL and use a project token with debug-files:upload. Pass
--org bugsinkhasnoorgs and your Bugsink project slug. I tested the upload with minified and unminified browser
builds, and both stack traces showed the original frame at captureException.js:2. The
Sourcemaps guide has the rest of the setup.
Keep using v3
If you need to keep calling sentry-cli, pin the install to 3.8.2.
npm install -g @sentry/cli@3.8.2npm install -g @sentry/cli@3.8.2
If the CLI is in package.json, set @sentry/cli to 3.8.2 there and commit the updated lockfile. npm ci uses
the lockfile.
For pip, use python -m pip install sentry-cli==3.8.2. For the installer at sentry.io/get-cli/, set
SENTRY_CLI_VERSION=3.8.2 in the install step.
See Sentry’s v3-to-v4 migration guide for other command and flag changes.
