# @sasjs/cli 中文文档

规范地址：https://npmcn.com/package/%40sasjs/cli/

版本：6\.8\.0
npm 元数据更新时间：2026-11-02T09:25:56.710Z
中文译文更新时间：2026-11-02T10:01:44.699Z
软件包许可：ISC

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40sasjs/cli
原文对照：https://npmcn.com/package/%40sasjs/cli/?lang=original
项目主页：https://cli.sasjs.io/
源码仓库：https://github.com/sasjs/cli

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：3.6 MB，673 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=22
- 运行依赖：19 个
- 首次发布：2020-07-07T21:04:24.804Z
- 最新版本发布：2026-11-02T09:25:56.291Z
- 已发布版本数：470（近 12 个月 66 个）

## 中文简介

sasj的命令行接口

## 安装

```sh
npm install @sasjs/cli
```

也可以使用：`pnpm add @sasjs/cli`、`yarn add @sasjs/cli`、`bun add @sasjs/cli`

## README

# SASjs CLI

[![npm package](https://img.shields.io/npm/v/@sasjs/cli.svg)](http://npmjs.org/package/@sasjs/cli) [![Github Workflow](https://github.com/sasjs/cli/actions/workflows/run-tests.yml/badge.svg)](https://github.com/sasjs/cli/blob/main/.github/workflows/run-tests.yml) ![npm](https://img.shields.io/npm/dt/@sasjs/cli) ![GitHub top language](https://img.shields.io/github/languages/top/sasjs/cli) [![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/sasjs/cli)](https://github.com/sasjs/cli/issues?q=is%3Aissue+is%3Aclosed) [![GitHub issues](https://img.shields.io/github/issues-raw/sasjs/cli)](https://github.com/sasjs/cli/issues)

`@sasjs/cli` 是一个命令行界面，用于帮助在SAS平台（包括SAS 9和Viya）上创建、构建和部署数据科学项目和HTML5 Web应用程序。功能包括:

-   在几秒钟内搭建一个新的SAS应用程序(`sasjs create myApp -t jobs`）
-   编译/构建SAS作业，服务和宏 _在本地_ 部署/执行 _远程_，与其他开发人员隔离(`sasjs cbd`）
-   无需重新编译即可构建和部署—当磁盘上的服务已经是您想要交付的服务时(`sasjs bd`）
-   编译单个作业、服务或测试，而不触及构建的其余部分(`sasjs compile identify --source sasjs/jobs/daily/load.sas`）
-   编写测试覆盖报告给 `sasjsbuild/coverage.json` 在每次编译时，为发布CI作业做好准备
-   不依赖于服务器文件系统
-   可选地将本地文件夹同步到服务器文件系统，使用 `sasjs fs`
-   触发Viya作业和流程(`sasjs job execute` / `sasjs flow execute`）
-   来执行代码质量规则 `sasjs lint`
-   检查SAS实际打印的内容，并在其上失败一个管道 `sasjs logcheck` —同一检查报告的日志 `run`， `request`， `job execute` 和 `flow execute`，也可以通过 `logCheck.autoCheck`
-   生成HTML5文档（需要氧） `sasjs doc`
-   创建并执行SAS测试(`sasjs test`）

还有一个特性可以让您将前端应用程序部署为一组流web服务，而无需部署到SAS web Server。

下面显示了使用它编译、构建和部署一组SAS Viya作业的快速演示。

[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/KKfUHTngSFo/0.jpg)](https://www.youtube.com/watch?v=KKfUHTngSFo)

## 安装

1.  使用全局安装 `npm` 如下:

```
  npm i -g @sasjs/cli
```

您也可以不通过NPX部署而使用该工具，如下所示：

```
npx @sasjs/cli <command>
```

## 文档

其他文档可以在 [SASjs命令行文档](https://cli.sasjs.io/) 网站。

## 笔记

运行 `npm i -g @sasjs/cli@latest` 并不总是正确升级。这是由于npm中的一个已知错误，该错误已在npm 7中修复。

如果你正在运行版本6或以下的NPM，你可以尝试运行 `npm update -g @sasjs/cli` 或者——大锤式的方法——从NPM文件夹中删除这些文件，然后重新安装。

## 贡献

看到 [CONTRIBUTING.md](https://npmcn.com/package/%40sasjs/cli/CONTRIBUTING.md) 用于本地设置。

## 星凝视

如果你觉得这个库有用，请留下星号，帮助我们发展星图！

![](https://starchart.cc/sasjs/cli.svg)

## 贡献者✨

感谢这些了不起的人([emoji关键](https://allcontributors.org/docs/en/emoji-key)):

<table><tbody><tr><td align="center"><a href="https://github.com/saadjutt01" rel="nofollow noopener noreferrer"><img alt="Muhammad Saad " src="https://avatars.githubusercontent.com/u/8914650?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>默罕默德萨德</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=saadjutt01" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/sasjs/cli/commits?author=saadjutt01" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://github.com/sasjs/cli/pulls?q=is%3Apr+reviewed-by%3Asaadjutt01" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-mentoring-saadjutt01" title="Mentoring" rel="nofollow noopener noreferrer">🧑‍🏫</a> <a href="https://github.com/sasjs/cli/commits?author=saadjutt01" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://www.erudicat.com/" rel="nofollow noopener noreferrer"><img alt="Yury Shkoda" src="https://avatars.githubusercontent.com/u/25773492?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>尤里·Shkoda</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=YuryShkoda" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-projectManagement-YuryShkoda" title="Project Management" rel="nofollow noopener noreferrer">📆</a> <a href="https://github.com/sasjs/cli/commits?author=YuryShkoda" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-video-YuryShkoda" title="Videos" rel="nofollow noopener noreferrer">📹</a> <a href="https://github.com/sasjs/cli/commits?author=YuryShkoda" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://krishna-acondy.io/" rel="nofollow noopener noreferrer"><img alt="Krishna Acondy" src="https://avatars.githubusercontent.com/u/2980428?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>克里希纳Acondy</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=krishna-acondy" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/sasjs/cli/commits?author=krishna-acondy" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-infra-krishna-acondy" title="Infrastructure (Hosting, Build-Tools, etc)" rel="nofollow noopener noreferrer">🚇</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-content-krishna-acondy" title="Content" rel="nofollow noopener noreferrer">🖋</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-maintenance-krishna-acondy" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-platform-krishna-acondy" title="Packaging/porting to new platform" rel="nofollow noopener noreferrer">📦</a> <a href="https://github.com/sasjs/cli/pulls?q=is%3Apr+reviewed-by%3Akrishna-acondy" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a></td><td align="center"><a href="https://github.com/medjedovicm" rel="nofollow noopener noreferrer"><img alt="Mihajlo Medjedovic" src="https://avatars.githubusercontent.com/u/18329105?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>Mihajlo Medjedovic</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=medjedovicm" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-infra-medjedovicm" title="Infrastructure (Hosting, Build-Tools, etc)" rel="nofollow noopener noreferrer">🚇</a> <a href="https://github.com/sasjs/cli/commits?author=medjedovicm" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://github.com/sasjs/cli/pulls?q=is%3Apr+reviewed-by%3Amedjedovicm" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a></td><td align="center"><a href="https://github.com/allanbowe" rel="nofollow noopener noreferrer"><img alt="Allan Bowe" src="https://avatars.githubusercontent.com/u/4420615?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>艾伦·鲍</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=allanbowe" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/sasjs/cli/pulls?q=is%3Apr+reviewed-by%3Aallanbowe" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a> <a href="https://github.com/sasjs/cli/commits?author=allanbowe" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-video-allanbowe" title="Videos" rel="nofollow noopener noreferrer">📹</a> <a href="https://github.com/sasjs/cli/commits?author=allanbowe" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://github.com/sabhas" rel="nofollow noopener noreferrer"><img alt="Sabir Hassan" src="https://avatars.githubusercontent.com/u/82647447?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>萨比尔哈桑</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=sabhas" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/sasjs/cli/pulls?q=is%3Apr+reviewed-by%3Asabhas" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a> <a href="https://github.com/sasjs/cli/commits?author=sabhas" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://npmcn.com/package/%40sasjs/cli/#readme-ideas-sabhas" title="Ideas, Planning, &amp; Feedback" rel="nofollow noopener noreferrer">🤔</a></td><td align="center"><a href="https://github.com/VladislavParhomchik" rel="nofollow noopener noreferrer"><img alt="VladislavParhomchik" src="https://avatars.githubusercontent.com/u/83717836?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>VladislavParhomchik</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=VladislavParhomchik" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://github.com/sasjs/cli/pulls?q=is%3Apr+reviewed-by%3AVladislavParhomchik" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a></td></tr><tr><td align="center"><a href="http://rudvfaden.github.io/" rel="nofollow noopener noreferrer"><img alt="Rud Faden" src="https://avatars.githubusercontent.com/u/2445577?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>路德法登</b></sub></a><br><a href="https://github.com/sasjs/cli/issues?q=author%3Arudvfaden" title="Bug reports" rel="nofollow noopener noreferrer">🐛</a></td><td align="center"><a href="https://sead.dev/" rel="nofollow noopener noreferrer"><img alt="Sead Mulahasanović" src="https://avatars.githubusercontent.com/u/8067014?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>看见Mulahasanović</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=mulahasanovic" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/tmoody" rel="nofollow noopener noreferrer"><img alt="Trevor Moody" src="https://avatars.githubusercontent.com/u/79837106?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>特雷福喜怒无常</b></sub></a><br><a href="https://github.com/sasjs/cli/commits?author=tmoody" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr></tbody></table>

本项目遵循 [所有捐款](https://github.com/all-contributors/all-contributors) 规范。欢迎任何形式的贡献！

## 常见问题

### @sasjs/cli 是什么？

sasj的命令行接口

### 如何安装 @sasjs/cli？

在项目目录运行 npm install @sasjs/cli，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 sasjs，可以用 npx sasjs 直接运行。

### @sasjs/cli 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/sasjs\_\_cli 是否存在。

### @sasjs/cli 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @sasjs/cli 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @sasjs/cli 可以商用吗？

@sasjs/cli 使用 ISC 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @sasjs/cli 还在维护吗？

最新版本 6\.8\.0 发布于 2026/11/02（1 天前）；至今共发布 470 个版本，其中过去 12 个月发布了 66 个；首次发布于 2020/07/08。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

