Summary
npm install -g @larksuite/cli can complete successfully but produce an unusable installation when npm config set ignore-scripts true is enabled.
The current README only says:
npm install -g @larksuite/cli
but does not explain that the npm package depends on postinstall to download the actual prebuilt Go binary.
This is surprising for users who intentionally keep ignore-scripts=true for security reasons.
Environment
- OS: Linux x86_64 (WSL2)
- Node.js:
v22.17.1
- npm:
10.9.2
- lark-cli npm package:
@larksuite/cli@1.0.5
- npm config:
ignore-scripts=true
Reproduction
- Enable script blocking:
npm config set ignore-scripts true
- Install the CLI:
npm install -g @larksuite/cli
- Verify the global entry exists:
Example:
lark-cli is /home/luo/.nvm/versions/node/v22.17.1/bin/lark-cli
- Run the command:
Actual Behavior
- The npm install finishes successfully.
- The global
lark-cli entry exists.
- But the command exits without a useful error because the real binary was never downloaded.
In my case, the global shim points to:
~/.nvm/versions/node/v22.17.1/lib/node_modules/@larksuite/cli/scripts/run.js
and scripts/run.js expects:
but that file does not exist, because postinstall was skipped.
Expected Behavior
At minimum, one of the following should happen:
- The README clearly states that the npm installation depends on
postinstall, and that ignore-scripts=true will produce an incomplete installation.
scripts/run.js detects missing bin/lark-cli and prints an actionable error such as:
- the binary is missing
postinstall may have been skipped
- how to recover (
node scripts/install.js or reinstall with scripts enabled)
- Preferably, the package distribution should support users who block install scripts by default, for example via platform packages / optionalDependencies / bundled binaries.
Why This Matters
Many developers set ignore-scripts=true intentionally as a security baseline.
For this package, the install appears successful even though the CLI is unusable. That makes the failure mode confusing:
- README says the package is ready after
npm install -g @larksuite/cli
- npm does not report an error
- the command exists in
PATH
- but the CLI does not actually work
Additional Context
From the repository:
package.json defines:
"bin": { "lark-cli": "scripts/run.js" }
"postinstall": "node scripts/install.js"
scripts/install.js downloads the prebuilt binary from GitHub Releases / mirror
scripts/run.js executes the downloaded binary from bin/lark-cli
So the project already has prebuilt binaries, but the npm package currently relies on postinstall to materialize them.
Suggested Improvements
- Update both
README.md and README.zh.md installation sections to document the postinstall dependency explicitly.
- Add a friendly runtime check in
scripts/run.js when bin/lark-cli is missing.
- Consider an installation mode that does not depend on
postinstall for security-conscious environments.
Summary
npm install -g @larksuite/clican complete successfully but produce an unusable installation whennpm config set ignore-scripts trueis enabled.The current README only says:
but does not explain that the npm package depends on
postinstallto download the actual prebuilt Go binary.This is surprising for users who intentionally keep
ignore-scripts=truefor security reasons.Environment
v22.17.110.9.2@larksuite/cli@1.0.5ignore-scripts=trueReproduction
type lark-cliExample:
Actual Behavior
lark-clientry exists.In my case, the global shim points to:
and
scripts/run.jsexpects:but that file does not exist, because
postinstallwas skipped.Expected Behavior
At minimum, one of the following should happen:
postinstall, and thatignore-scripts=truewill produce an incomplete installation.scripts/run.jsdetects missingbin/lark-cliand prints an actionable error such as:postinstallmay have been skippednode scripts/install.jsor reinstall with scripts enabled)Why This Matters
Many developers set
ignore-scripts=trueintentionally as a security baseline.For this package, the install appears successful even though the CLI is unusable. That makes the failure mode confusing:
npm install -g @larksuite/cliPATHAdditional Context
From the repository:
package.jsondefines:"bin": { "lark-cli": "scripts/run.js" }"postinstall": "node scripts/install.js"scripts/install.jsdownloads the prebuilt binary from GitHub Releases / mirrorscripts/run.jsexecutes the downloaded binary frombin/lark-cliSo the project already has prebuilt binaries, but the npm package currently relies on
postinstallto materialize them.Suggested Improvements
README.mdandREADME.zh.mdinstallation sections to document thepostinstalldependency explicitly.scripts/run.jswhenbin/lark-cliis missing.postinstallfor security-conscious environments.